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: Coverting a PL/SQL script into single query

Re: Coverting a PL/SQL script into single query

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Tue, 25 Feb 2003 08:52:58 -0800
Message-ID: <3E5B9F6A.979C4515@exesolutions.com>


prasanna wrote:

> Hi all,
>
> This is the table:
>
> SQL> descr cs_blob_data;
> Name Null? Type
> ------------------------------- -------- ----
> SCHOOL_ID NUMBER
> SCHOOL_ORDINAL NUMBER
> SCHOOL_DATA VARCHAR2(20)
>
> SQL>
>
> This is the script. Can any one help me in converting this into single query
>
> declare
> last_ordinal number;
> next_ordinal number;
> school_identifier number;
> input_text varchar(75);
> begin
> select school_id,max(school_ordinal) into school_identifie,last_ordinal from
> cs_school_data where school_id=1;
> input_text:='Stanford'';
> next_ordinal:=last_ordinal+1;
> insert into cs_school_data(school_id,school_ordinal,school_data) values
> (school_identifier,next_ordinal,input_text);
> end if;
> end;
>
> Thanks In Advance,
> Prasanna

Make the first query a subquery in the WHERE clause of the second query. And correct the misspellings.

We give hints ... not solutions for schoolwork.

Daniel Morgan Received on Tue Feb 25 2003 - 10:52:58 CST

Original text of this message

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