Re: Multiple SQL statements without separators (port from Sybase)

From: DanHW <danhw_at_aol.com>
Date: 2000/05/13
Message-ID: <20000512200736.19506.00001697_at_ng-fa1.aol.com>#1/1


>I am porting an existing application that makes use of Sybase's ability
>to execute multiple sql statements issued as a single string but it
>seems that Oracle cannot do the same thing.
>
>In Sybase (isql utility or using the C++ client library) one can issue
>the following (note there are NO separators between statements):
>
>delete table1 where column1=0
>select * from table2
>go
>
>Is there an Oracle equivalent or near equivalent to this? I would
>rather not have to change the large amount of existing application code,
>but since all statements are sent through a library (that I am writing
>to "fake out" our existing Sybase library), I could live with adding to
>the beginning or end of the statement before sending it to Oracle via
>OCI calls. Having to parse the string into separate statements is
>really not something we want to get into because it is generated by any
>of several other processes and can be arbitrarily complex.
>
>Thanks in advance for any help,
>
>Brad Lotsberg, EET.
>
There is no native equivalent because Oracle needs a terminator (how does the example know when to execute what is has vs read the next line...

select a,b from my_table
where b=a

??

Anyway, you could use use the UTL_FILE utility to read in a line and the use DBMS_SQL to execute it.
(if you are not familiar with those UTL_FILE reads an operating system file and DBMS_SQL lets you build a string and execute it as a SQL statement)

Hope that helps

Dan Hekimian-Williams Received on Sat May 13 2000 - 00:00:00 CEST

Original text of this message