?
Solved

PL-SQL Delete statement from VB.NET Application

Posted on 2011-02-23
3
Medium Priority
?
650 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

752 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