473,799 Members | 2,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle throwing an exception, "ORA-01036: illegal variable name/nu

Hello:

I wrote a small program to insert a row into an Oracle Table:

CREATE TABLE case_list
(case_list_name _c VARCHAR2(100) NOT NULL,
expiry_dt DATE NOT NULL,
days_to_expire_ n NUMBER(*,0),
created_dt DATE DEFAULT SYSDATE,
created_by_n NUMBER)

When I execute the following code,
Using connection As New OracleConnectio n(myConnection)
Dim lsString As String
lsString = "INSERT INTO CASE_LIST (CASE_LIST_NAME _C, EXPIRY_DT,
DAYS_TO_EXPIRE_ N, CREATED_DT, CREATED_BY_N) Values (@CASE_LIST_NAM E_C,
@EXPIRY_DT, @DAYS_TO_EXPIRE _N, @CREATED_DT, @CREATED_BY_N)"

Dim command As New OracleCommand
command = New OracleCommand(l sString)
command.Command Type = CommandType.Tex t
command.Paramet ers.Add("@CASE_ LIST_NAME_C", OracleType.VarC har,
100)
command.Paramet ers.Add("@EXPIR Y_DT", OracleType.Date Time)
command.Paramet ers.Add("@DAYS_ TO_EXPIRE_N", OracleType.Numb er)
command.Paramet ers.Add("@CREAT ED_DT", OracleType.Date Time)
command.Paramet ers.Add("@CREAT ED_BY_N", OracleType.Numb er)
command.Connect ion = connection
Try
connection.Open ()
command.Paramet ers("@CASE_LIST _NAME_C").Value = "Test"
command.Paramet ers("@EXPIRY_DT ").Value = Date.Today
command.Paramet ers("@DAYS_TO_E XPIRE_N").Value = 100
command.Paramet ers("@CREATED_D T").Value = Date.Today
command.Paramet ers("@CREATED_B Y_N").Value = 2
command.Execute NonQuery()

Catch ex As Exception
MessageBox.Show (ex.Message)
End Try
End Using
I get an exception "ORA-01036: illegal variable name/number "

Can somebody tell me what I am doing wrong?

Thanks.

venki
Oct 12 '06 #1
2 14439
venki,

I believe that Oracle named parameters must begin with a :, not an @.

Kerry Moorman
"vvenk" wrote:
Hello:

I wrote a small program to insert a row into an Oracle Table:

CREATE TABLE case_list
(case_list_name _c VARCHAR2(100) NOT NULL,
expiry_dt DATE NOT NULL,
days_to_expire_ n NUMBER(*,0),
created_dt DATE DEFAULT SYSDATE,
created_by_n NUMBER)

When I execute the following code,
Using connection As New OracleConnectio n(myConnection)
Dim lsString As String
lsString = "INSERT INTO CASE_LIST (CASE_LIST_NAME _C, EXPIRY_DT,
DAYS_TO_EXPIRE_ N, CREATED_DT, CREATED_BY_N) Values (@CASE_LIST_NAM E_C,
@EXPIRY_DT, @DAYS_TO_EXPIRE _N, @CREATED_DT, @CREATED_BY_N)"

Dim command As New OracleCommand
command = New OracleCommand(l sString)
command.Command Type = CommandType.Tex t
command.Paramet ers.Add("@CASE_ LIST_NAME_C", OracleType.VarC har,
100)
command.Paramet ers.Add("@EXPIR Y_DT", OracleType.Date Time)
command.Paramet ers.Add("@DAYS_ TO_EXPIRE_N", OracleType.Numb er)
command.Paramet ers.Add("@CREAT ED_DT", OracleType.Date Time)
command.Paramet ers.Add("@CREAT ED_BY_N", OracleType.Numb er)
command.Connect ion = connection
Try
connection.Open ()
command.Paramet ers("@CASE_LIST _NAME_C").Value = "Test"
command.Paramet ers("@EXPIRY_DT ").Value = Date.Today
command.Paramet ers("@DAYS_TO_E XPIRE_N").Value = 100
command.Paramet ers("@CREATED_D T").Value = Date.Today
command.Paramet ers("@CREATED_B Y_N").Value = 2
command.Execute NonQuery()

Catch ex As Exception
MessageBox.Show (ex.Message)
End Try
End Using
I get an exception "ORA-01036: illegal variable name/number "

Can somebody tell me what I am doing wrong?

Thanks.

venki
Oct 12 '06 #2
Kerry:

You are a God-send! Thank you. That was the issue.

"Kerry Moorman" wrote:
venki,

I believe that Oracle named parameters must begin with a :, not an @.

Kerry Moorman
"vvenk" wrote:
Hello:

I wrote a small program to insert a row into an Oracle Table:

CREATE TABLE case_list
(case_list_name _c VARCHAR2(100) NOT NULL,
expiry_dt DATE NOT NULL,
days_to_expire_ n NUMBER(*,0),
created_dt DATE DEFAULT SYSDATE,
created_by_n NUMBER)

When I execute the following code,
Using connection As New OracleConnectio n(myConnection)
Dim lsString As String
lsString = "INSERT INTO CASE_LIST (CASE_LIST_NAME _C, EXPIRY_DT,
DAYS_TO_EXPIRE_ N, CREATED_DT, CREATED_BY_N) Values (@CASE_LIST_NAM E_C,
@EXPIRY_DT, @DAYS_TO_EXPIRE _N, @CREATED_DT, @CREATED_BY_N)"

Dim command As New OracleCommand
command = New OracleCommand(l sString)
command.Command Type = CommandType.Tex t
command.Paramet ers.Add("@CASE_ LIST_NAME_C", OracleType.VarC har,
100)
command.Paramet ers.Add("@EXPIR Y_DT", OracleType.Date Time)
command.Paramet ers.Add("@DAYS_ TO_EXPIRE_N", OracleType.Numb er)
command.Paramet ers.Add("@CREAT ED_DT", OracleType.Date Time)
command.Paramet ers.Add("@CREAT ED_BY_N", OracleType.Numb er)
command.Connect ion = connection
Try
connection.Open ()
command.Paramet ers("@CASE_LIST _NAME_C").Value = "Test"
command.Paramet ers("@EXPIRY_DT ").Value = Date.Today
command.Paramet ers("@DAYS_TO_E XPIRE_N").Value = 100
command.Paramet ers("@CREATED_D T").Value = Date.Today
command.Paramet ers("@CREATED_B Y_N").Value = 2
command.Execute NonQuery()

Catch ex As Exception
MessageBox.Show (ex.Message)
End Try
End Using
I get an exception "ORA-01036: illegal variable name/number "

Can somebody tell me what I am doing wrong?

Thanks.

venki
Oct 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4046
by: lars-jacob hove | last post by:
Hello. I'm having trouble importing images. I have the following procedure : declare Image ORDSYS.ORDImage; ctx RAW(4000) := null; begin insert into bilde_test values (
1
7162
by: Jawahar | last post by:
All, I have a C# application with an Oracle backend. There is a fair amount of locking being used to prevent two users from update the same records. So we use the Oracle FOR UPDATE NOWAIT in our SQL calls. This works fine and the second user is not allowed to access the same record as the first user. Currently we are using a try catch block to catch the Oracle exception ORA-0054. Then we exit the subroutine. I am trying to look for a...
11
23035
by: Chris Fink | last post by:
I have setup an Oracle table which contains a blob field. How do I insert data into this field using C# and ADO.net?
1
2548
by: Velrajan | last post by:
sql>sys/manager as sysdba it give error ora-01031 insufficent privileges i am connect with administrator user and it is a member of ora_dba group so whats the reason please give me correct solution By
2
18910
by: samyuktha takkellapati | last post by:
create or replace trigger emp_trigger after update or delete on employee for each row begin if updating then insert into empupdate(empno,ename,job,mgr,sysdate,sal,comm,deptno) values(:old.empno,:old.ename,:old.job,:old.mgr,:old.hiredate,:old.sal,:old.comm,:old.deptno); elsif deleting then insert into empdelete(empno,ename,job,mgr,sysdate,sal,comm,deptno)...
2
6324
by: hemantmudaliar | last post by:
The Trigger is giving following exception java.sql.SQLException: ORA-04091: table PSCONTENT.VGNASCHANNEL is mutating, trigger/function may not see it ORA-06512: at "PSCONTENT.CHECK_CHANNEL_UNPUBLISH", line 4 ORA-06512: at "PSCONTENT.CHECK_CHANNEL_UNPUBLISH_TR", line 1 ORA-04088: error during execution of trigger ................................ // Trigger CREATE OR REPLACE TRIGGER check_channel_unpublish_tr before delete ON...
1
17788
by: thewickedman | last post by:
Hi, I try to open new OpenOffice document (writer), But I am getting the exception FRM 40735:WHEN-BUTTON-PRESSED Trigger Raised unhandled Exception ORA - 305500 Please help me to resolve this exception. my code is as follows in when-button-pressed trigger:
1
1900
by: shaikmonster | last post by:
Hi all! I have a Access db with some vb running sql against an oracle db... It works well at some of our sites, but I get an ora-00907 error in other places. I think the problem comes in the following line : sql9 = "(select sum(decode(substr(result_type,1,1),'C',1,0)) from prospect_contact pc,prospect_base pb, base_pledge bp,segment_group_control sg,campus.result_codes rc where pb.id_number = pc.id_number And pb.segment_group =...
0
1888
by: roneon | last post by:
This is the problem that the topic starter posted: "we installed Oracle-Client 8.1.7 on a server with Windows 2000 Terminal-Services and Citrix Metaframe Xp. The Forms-Applications we wrote are on a fileserver.
0
1915
by: sangam56 | last post by:
Hi world. I am trying to add Get method in an asp.net dataset (.xsd) file. I am using oledb provider and my select statement supplies a parameter using a colon (:). e.g. :parameter1 It does not accept @ or ?. It works fine when run from query builder but gives problem when i try to preview data in the dataset. The error is: ORA-01008: not all variables bound
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.