473,413 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

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 OracleConnection(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_NAME_C,
@EXPIRY_DT, @DAYS_TO_EXPIRE_N, @CREATED_DT, @CREATED_BY_N)"

Dim command As New OracleCommand
command = New OracleCommand(lsString)
command.CommandType = CommandType.Text
command.Parameters.Add("@CASE_LIST_NAME_C", OracleType.VarChar,
100)
command.Parameters.Add("@EXPIRY_DT", OracleType.DateTime)
command.Parameters.Add("@DAYS_TO_EXPIRE_N", OracleType.Number)
command.Parameters.Add("@CREATED_DT", OracleType.DateTime)
command.Parameters.Add("@CREATED_BY_N", OracleType.Number)
command.Connection = connection
Try
connection.Open()
command.Parameters("@CASE_LIST_NAME_C").Value = "Test"
command.Parameters("@EXPIRY_DT").Value = Date.Today
command.Parameters("@DAYS_TO_EXPIRE_N").Value = 100
command.Parameters("@CREATED_DT").Value = Date.Today
command.Parameters("@CREATED_BY_N").Value = 2
command.ExecuteNonQuery()

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 14411
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 OracleConnection(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_NAME_C,
@EXPIRY_DT, @DAYS_TO_EXPIRE_N, @CREATED_DT, @CREATED_BY_N)"

Dim command As New OracleCommand
command = New OracleCommand(lsString)
command.CommandType = CommandType.Text
command.Parameters.Add("@CASE_LIST_NAME_C", OracleType.VarChar,
100)
command.Parameters.Add("@EXPIRY_DT", OracleType.DateTime)
command.Parameters.Add("@DAYS_TO_EXPIRE_N", OracleType.Number)
command.Parameters.Add("@CREATED_DT", OracleType.DateTime)
command.Parameters.Add("@CREATED_BY_N", OracleType.Number)
command.Connection = connection
Try
connection.Open()
command.Parameters("@CASE_LIST_NAME_C").Value = "Test"
command.Parameters("@EXPIRY_DT").Value = Date.Today
command.Parameters("@DAYS_TO_EXPIRE_N").Value = 100
command.Parameters("@CREATED_DT").Value = Date.Today
command.Parameters("@CREATED_BY_N").Value = 2
command.ExecuteNonQuery()

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 OracleConnection(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_NAME_C,
@EXPIRY_DT, @DAYS_TO_EXPIRE_N, @CREATED_DT, @CREATED_BY_N)"

Dim command As New OracleCommand
command = New OracleCommand(lsString)
command.CommandType = CommandType.Text
command.Parameters.Add("@CASE_LIST_NAME_C", OracleType.VarChar,
100)
command.Parameters.Add("@EXPIRY_DT", OracleType.DateTime)
command.Parameters.Add("@DAYS_TO_EXPIRE_N", OracleType.Number)
command.Parameters.Add("@CREATED_DT", OracleType.DateTime)
command.Parameters.Add("@CREATED_BY_N", OracleType.Number)
command.Connection = connection
Try
connection.Open()
command.Parameters("@CASE_LIST_NAME_C").Value = "Test"
command.Parameters("@EXPIRY_DT").Value = Date.Today
command.Parameters("@DAYS_TO_EXPIRE_N").Value = 100
command.Parameters("@CREATED_DT").Value = Date.Today
command.Parameters("@CREATED_BY_N").Value = 2
command.ExecuteNonQuery()

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
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
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...
11
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
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...
2
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)...
2
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...
1
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...
1
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...
0
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 ...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...

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.