Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Rookie question: "create procedure"

Re: Rookie question: "create procedure"

From: Erika Grondzakova <Erika.Grondzakova_at_cern.ch>
Date: 2000/03/10
Message-ID: <38C8B1B3.19A8A15A@cern.ch>#1/1

Hello,

What about...

create or replace procedure getdate is
 my_date date;
 begin
  select sysdate into my_date from dual;   dbms_output.put_line (my_date);
 end;

Hth,

Erika

George E. Allen wrote:
>
> Ok, so we all know the famous: "select sysdate from dual;" statement
> to get the current date, but why can't I put this same simple
> statement into a stored procedure?
>
>
> D:\Oracle\816_Home> sqlplus scott/tiger
> SQL*Plus: Release 8.1.6.0.0 - Production on Thu Mar 9
> 16:33:11 2000
> (c) Copyright 1999 Oracle Corporation. All rights reserved.
>
> Connected to:
> Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
> With the Partitioning option
> JServer Release 8.1.6.0.0 - Production
>
> SQL> select sysdate from dual;
>
> SYSDATE
> ---------
> 09-MAR-00
>
> SQL> create or replace procedure getdate is begin select
> sysdate from dual; end;
> 2 /
>
> Warning: Procedure created with compilation errors.
>
> SQL> show errors
> Errors for PROCEDURE GETDATE:
>
> LINE/COL ERROR
> --------
> -----------------------------------------------------------------
>
> 1/28 PLS-00428: an INTO clause is expected in this
> SELECT statement
> 1/28 PL/SQL: SQL Statement ignored
>
>
> Also, I don't understand why the begin / end was necessary -- can't I
> have a single PL/SQL statement in a stored procedure?
>
> Thanks,
>
> George.
>
  Received on Fri Mar 10 2000 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US