Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Coverting a PL/SQL script into single query
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