Solved

PL-SQL Delete statement from VB.NET Application

Posted on 2011-02-23
3
638 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net - Not Sure if Multi-threading is What I Need 4 42
Loading flat file data in tables 2 66
Access Schema 6 45
Pivoting oracle table 9 75
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.
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 videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
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.

730 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