Error 42000 Oracle Odbc
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta odbc error 42000 vcenter Discuss the workings and policies of this site About Us Learn more error 42000 microsoft odbc sql server driver about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Syntax error while trying to call an Oracle package using ODBC in C# up vote 2 down vote favorite I'm trying to consume an Oracle 9i package using ODBC and C#. I've tried to use the syntax described in here, here, here and here but I can't seem to get it right. Note: I'm not allowed to use ODAC/ODP.NET in this particular case. This is the package structure: DECLARE PARAM1 NUMBER; --in PARAM2 VARCHAR2(200); --out PARAM3 VARCHAR2(200); --out PARAM4 VARCHAR2(200); --out BEGIN PARAM1 := 123; PARAM2 := NULL; PARAM3 := NULL; PARAM4 := NULL; TESTUSER.TESTPKG.TESTFUNC(PARAM1, PARAM2, PARAM3, PARAM4); DBMS_OUTPUT.Put_Line(PARAM2); DBMS_OUTPUT.Put_Line(PARAM3); DBMS_OUTPUT.Put_Line(PARAM4); COMMIT; END; This is how I'm calling the package: string var1 = "123"; int var2; OdbcConnection cn = new OdbcConnection("Driver={Microsoft ODBC for Oracle};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=TESTHOST)(PORT=1234))(CONNECT_DATA=(SID=TESTSID)));Uid=TESTUSER;Pwd=TESTPASS;"); cn.Open(); using (OdbcCommand cmd = new OdbcCommand("{ BEGIN ? := CALL TESTUSER.TESTPKG.TESTFUNC(?,?,?,?); END; }", conn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "TESTUSER.TESTPKG.TESTFUNC"; cmd.Parameters.Add("PARAM1", OdbcType.Decimal).Direction = System.Data.ParameterDirection.Input; cmd.Parameters["PARAM1"].Value = var1; cmd.Parameters.Add("PARAM2", OdbcType.VarChar).Direction = System.Data.ParameterDirection.Output; cmd.Parameters.Add("PARAM3", OdbcType.VarChar).Direction = System.Data.ParameterDirection.Output; cmd.Parameters.Add("PARAM4", OdbcType.VarChar).Direction = System.Data.ParameterDirection.Output; cmd.ExecuteNonQuery(); int.TryParse(cmd.Parameters["PARAM2"].Value.ToString(), out var2); uAcctStatus = cmd.Parameters["PARAM3"].Value.ToString(); uReturnMsg = cmd.Parameters["PARAM4"].Value.ToString(); } cn.Close(); return var2; And this is the error message I'm receiving: Exception: ERROR [42000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00900: invalid SQL statement EDIT: I have tested the package and code and it works in ODAC/ODP.NET, but I was asked to cha
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> http://stackoverflow.com/questions/18837539/syntax-error-while-trying-to-call-an-oracle-package-using-odbc-in-c-sharp ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build http://www.codeproject.com/Questions/611914/ERROR-Oracle-ODBC-Ora-ORA-invalid-SQL Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ ERROR [42000] [Oracle][ODBC][Ora]ORA-00900: invalid SQL statement Rate this: Please Sign up or sign in to vote. See more: .NET Protected Sub BTNINSERT_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTNINSERT.Click CON = New OdbcConnection("DSN=DBLOG;Driver=(Oracle in XE);UID=system;PWD=SYS;SERVER=localhost;") CON.Open() MsgBox("successfully opened") comm = New OdbcCommand("INSERTLOG", CON) comm.CommandType = CommandType.StoredProcedure comm.Parameters.AddWithValue("ID_", TXTID.Text) comm.Parameters.AddWithValue("STUDENTNAME_", TXTNAME.Text) comm.Parameters.AddWithValue("DEPARTMENT_", TXTDEPART.Text) comm.Parameters.AddWithValue("YEAR_", TXTYEAR.Text) a = comm.ExecuteNonQuery If a > 0 Then MsgBox("success") Else MsgBox("failed") End If CON.Close() MsgBox("successfully closed") Posted 25-Jun-13 21:33pm seetha raman704 Updated 25-Jun-13
CommunityOracle User Group CommunityTopliners CommunityOTN Speaker BureauJava CommunityError: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page. https://community.oracle.com/thread/1408592 Please enter a title. You can not post a blank message. Please type your message and try again. More discussions in PL/SQL and SQL All PlacesDatabaseDatabase Application DevelopmentPL/SQL and http://www.tek-tips.com/viewthread.cfm?qid=1496598 SQL This discussion is archived 4 Replies Latest reply on Oct 7, 2010 1:58 PM by BluShadow Invalid SQL Statement when using execute for running Procedures 793919 Oct 2, error 42000 2010 2:15 PM Hi , I create a simple stored procedure , it was created successfully , when i tried to run the StoredProcedure , it is giving me exec myStoredProcedure() ; please tell me why this is coming . I have the same question Show 0 Likes(0) 588Views Tags: none (add) This content has been marked as final. error 42000 oracle Show 4 replies 1. Re: Invalid SQL Statement when using execute for running Procedures 719794 Oct 2, 2010 2:18 PM (in response to 793919) Can you show how you run the procedure? Like Show 0 Likes(0) Actions 2. Re: Invalid SQL Statement when using execute for running Procedures 803773 Oct 7, 2010 1:47 PM (in response to 719794) hi i am using oracle 10g with asp.net i have created a procedure and it executed successfully, when i executed with exce
Join INTELLIGENT WORK FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified Of ResponsesTo Your Posts Keyword Search One-Click Access To YourFavorite Forums Automated SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: Where: jobs by Link To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Business Objects: Crystal Reports 1 Formulas Forum at Tek-Tips HomeForumsProgrammersReporting SolutionsBusiness Objects: Crystal Reports 1 Formulas Forum '42000:[Oracle][ODBC]Syntax error or access violation' thread767-1496598 Forum Search FAQs Links MVPs '42000:[Oracle][ODBC]Syntax error or access violation' '42000:[Oracle][ODBC]Syntax error or access violation' ajonnjr (IS/IT--Management) (OP) 26 Aug 08 14:05 I am trying to added an external vendor's stored procedure located in an Oracle database using Crystal Report 11.This procedure requires three paramteres.When I add the procedure using the database expert. A parameter window appears requesting 'Discrete Values' for all.When I enter valid values in each parameter, an error message appears, 'Query Engine Error: '42000:[Oracle][ODBC]Syntax error or access violation'.I am using the Oracle drive,ODBC(RDO).Thanks! RE: '42000:[Oracle][ODBC]Syntax error or access violation' hilfy ( IS/IT--Management) 26 Aug 08 17:40 Is there a particular reason why you're using ODBC instead of a native Oracle connection?I've seen issues before with trying to access stored procs through an ODBC connection.-Dell A computer only does what you actually told it to do - not what you thought you told it to do. RE: '42000:[Oracle][ODBC]Syntax error