Home » SQL & PL/SQL » SQL & PL/SQL » Howto execute several sql statements in one command of the DataAdapter Class (Oracle ,11g,Windows XP)
Howto execute several sql statements in one command of the DataAdapter Class [message #561029] Wed, 18 July 2012 06:33 Go to next message
shmessage
Messages: 5
Registered: July 2012
Junior Member
Dear All,

When working with SQL Server it's possible to execute several sql statements in one command of the DataAdapter in ADO.Net
Now I try the same thing with an oracle database and recieve error ORA-00911: invalid character.

When remove ;character from query it again gives error- ORA-00933: SQL command not properly ended.

My query is like this-

update activity set activityname='Route Survey' where activityid=1;
SELECT * FROM activity where activityid=1

pls provide me solution.
Re: Howto execute several sql statements in one command of the DataAdapter Class [message #561037 is a reply to message #561029] Wed, 18 July 2012 07:03 Go to previous messageGo to next message
Michel Cadot
Messages: 57601
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Oracle does not support several statements in one shot (unless you put them in a PL/SQL block).

Regards
Michel
Re: Howto execute several sql statements in one command of the DataAdapter Class [message #561132 is a reply to message #561037] Thu, 19 July 2012 01:27 Go to previous messageGo to next message
shmessage
Messages: 5
Registered: July 2012
Junior Member
Actually i have existing application working with sql server
and now i want to implement this for Oracle as well.

so how this type of query will support with oracle
is there any way to implement this type of query(several sql statemnt in one command)

like-
update activity set activityname='Route Survey' where activityid=1;
SELECT * FROM activity where activityid=1

Re: Howto execute several sql statements in one command of the DataAdapter Class [message #561137 is a reply to message #561132] Thu, 19 July 2012 01:32 Go to previous messageGo to next message
Littlefoot
Messages: 18821
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Put these statements into a script (let's name it "my_script.sql") and execute it from the SQL*Plus command prompt:
SQL> $type my_script.sql
select sum(sal) from emp;
update emp set
  comm = 100
  where job = 'CLERK';
select * from dept;
SQL>
SQL> -- run it like this:
SQL> @my_script

  SUM(SAL)
----------
     40225


4 rows updated.


    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

SQL>
Re: Howto execute several sql statements in one command of the DataAdapter Class [message #561139 is a reply to message #561132] Thu, 19 July 2012 01:32 Go to previous message
Michel Cadot
Messages: 57601
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Do it in 2 statements (aren't they 2 statements?).

Regards
Michel
Previous Topic: REGEXP_LIKE
Next Topic: SQL query
Goto Forum:
  


Current Time: Wed Apr 16 09:58:22 CDT 2014

Total time taken to generate the page: 0.10302 seconds