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

Home -> Community -> Usenet -> c.d.o.misc -> Re: for loop mit select - Firebird -> Oracle

Re: for loop mit select - Firebird -> Oracle

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 17 May 2005 12:52:01 -0700
Message-ID: <1116359284.945486@yasure>


Werner Hofmann wrote:
> Hallo,
>
> in a firebird-procedure I habe the statement:
>
> for select TITLE in DOCUMENTS d where d.STATUS = 'online' do
> begin
> path = 'd:\'||vUserDir||'\'||TITLE;
> end
>
>
> this I need as a PSQL statement in an oracle-procedure.
> How does the code In oracle looks like?
>
> Regards, Werner

I have no idea as your code doesn't seem to do anything.

You have what looks like a cursor FOR loop which would look like this:

FOR rec IN (select TITLE in DOCUMENTS d where d.STATUS = 'online') LOOP END LOOP; But how you are going to assign multiple values, as you loop through records to a single variable, PATH, and accomplish anything is a mystery.

If on the other hand this isn't a loop then just:

SELECT title
INTO x
FROM DOCUMENTS
WHERE STATUS = 'online'

path := 'd:\'||vUserDir||'\'|| x;

Seems like you should be taking a PL/SQL class before trying to write it. Why are you doing it the other way around? A burning desire to write bad code and fail?

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Tue May 17 2005 - 14:52:01 CDT

Original text of this message

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