[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

PL-SQL Delete statement from VB.NET Application

Posted on 2011-02-23
3
Medium Priority
?
661 Views
Last Modified: 2012-05-11
Hi,
I am trying to delete some rows from Oracle Table using simple VB.NET Application.

 
Dim ClearSTR As String = "DELETE FROM STATEMENTS A " & _
           " WHERE EXISTS ( select  A.ACCNO " & _
           " from  reverselines T " & _
           " WHERE A.ACCNO = T.ACCNO AND A.FIYID= T.FIYID AND A.PERID = T.PERID AND A.LINENO = T.LINENO ); "

Dim daDelete As Oracle.DataAccess.Client.OracleDataAdapter = New Oracle.DataAccess.Client.OracleDataAdapter

daDelete.SelectCommand = New Oracle.DataAccess.Client.OracleCommand(ClearSTR, GetConnection)
daDelete.SelectCommand.ExecuteNonQuery()

Open in new window


and I am getting the following error message:

 
-- Error 
Oracle.DataAccess.Client.OracleException ORA-00911: invalid character    at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck)
   at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
   at BankRecon.Main.BankRemoveReverse_Click(Object sender, EventArgs e) in C:\Users\Rafal\Documents\Visual Studio 2008\Projects\BankRecon\BankRecon\Main.vb:line 2099

Open in new window


I checked the statement in in PL/SQL Developer application and there is no error, the command execute without any problem.

So where is the problem?

Thank you for your help.
0
Comment
Question by:rkanabus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 34959360
remove the ";" from the statment.
0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 1000 total points
ID: 34959362
I think you need to use delete command instade of select try thjis

daDelete.DeleteCommand = New Oracle.DataAccess.Client.OracleCommand(ClearSTR, GetConnection)
daDelete.DeleteCommand.ExecuteNonQuery()
0
 

Author Comment

by:rkanabus
ID: 34959420
Yes, fixed. I had to remove the ; character and then change the code to DeleteCommand..

Thanks for help.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question