Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Trouble executing data found on TABLE: exe_sel_dttime_xml (COLUMN: QUERY)
fitzjarrell_at_cox.net wrote:
> Comments embedded. > nicolas246_at_gmail.com wrote:
> > And it isn't doing what you want, or it isn't doing what you expect? > There is a difference. >
> > Define 'coding problems'; my crystal ball has been in disrepair for > years. >
> > What, exactly, is r? It appears to be a senselessly declared variable > of absolutely no use whatsoever. I should think the following loop > would be better suited to this task: > > declare > cursor get_qry is > select query from exe_sel_dttime_xml; > begin > for c_toexecute in get_qry loop > execute immediate c_toexecute; > end loop; > end; > / > >>> Basically what this code is supposed to do is execute each of the data
>> ------------------------------------------------------------------------------
> > Which is what I posted and should do exactly as you expect. >
> > Correction: you WANT this to work using that methodology. Use the > PL/SQL block I provided instead of the 'interesting block' you've tried > to code. >
> > WHY do you insist upon using SELECT ... INTO in a LOOP? Learn > something from the examples posted. >
> > > David Fitzjarrell >
the following workes for me:
REM This is the table that contains the statements to be executed CREATE TABLE t (f1 varchar2(70));
REM Statements to be executed
REM This simple example only allows DDL Statements or updates, delete,
inserts, no selects:
INSERT INTO T VALUES('create table t2(f1 date)') INSERT INTO T VALUES('create table t3(f1 date)') INSERT INTO T VALUES('create table t4(f1 date)') INSERT INTO T VALUES('create table t5(f1 date)')
REM procedure to execute the statements in table t
-- begin for c1 in (select f1 from t) loop execute immediate(c1.f1); end loop; end; / select table_name from user_tables; REM Look up whether tables have been created TABLE_NAME ------------------------------ T2 T3 T4 T best regards, NikReceived on Thu Aug 03 2006 - 04:52:02 CDT
![]() |
![]() |