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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Can I use "GOTO" with variables in PL/SQL?

RE: Can I use "GOTO" with variables in PL/SQL?

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Fri, 06 Dec 2002 09:15:20 -0800
Message-ID: <F001.00514956.20021206091520@fatcity.com>


you can do this (called as indirect referencing) within pl/sql using dynamic sql.

some info at
http://www.pinnaclepublishing.com/OP/OPmag.nsf/0/8196D5C00E2B1E7C852568DB004 FFBA4 ...
Raj



Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art!

-----Original Message-----
Sent: Friday, December 06, 2002 11:41 AM To: Multiple recipients of list ORACLE-L

Bill,

Sadly, I don't think this is possible. The PL/SQL compiler is just not that dynamic.

Pretty cooleo idea, though.

Tom Mercadante
Oracle Certified Professional

-----Original Message-----
Sent: Friday, December 06, 2002 11:19 AM To: Multiple recipients of list ORACLE-L

Good day, all:

I'm writing a script where the user can specify at run-time if they want to run the entire script or just one numbered piece. One way I thought of implementing this is pasted below, but the line "goto v_crlabel" is not recognized - evidently the PL/SQL engine is not substituting in the value for the variable.

Does anyone know if this is possible? If not, I can just prefix each block by an if..then statement to test for the value in v_cr . . . but I thought it could be cool to try it this way.

Thanks
bill


accept i_cr prompt 'Enter CR to run: '

declare

v_cr number := &&i_cr;
v_crlabel varchar2(30) := 'CR' || to_char(v_cr);

begin

if v_cr is not null then

    goto v_crlabel;
else

    goto endrun;
end if;

<<CR5>>
dbms_output.put_line('Successfully went to CR5'); goto endrun;

<<CR6>>
dbms_output.put_line('Successfully went to CR6'); goto endrun;

<<CR7>>
dbms_output.put_line('Successfully went to CR7'); goto endrun;

<<ENDRUN>>
NULL;
dbms_output.put_line('Went to ENDRUN');

end;
/

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Magaliff, Bill
  INET: Bill.Magaliff_at_lendware.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Mercadante, Thomas F
  INET: NDATFM_at_labor.state.ny.us
Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Jamadagni, Rajendra
  INET: Rajendra.Jamadagni_at_espn.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Received on Fri Dec 06 2002 - 11:15:20 CST

Original text of this message

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