Solved

PL-SQL Delete statement from VB.NET Application

Posted on 2011-02-23
3
644 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 250 total points
ID: 34959360
remove the ";" from the statment.
0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 250 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

728 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