Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SP2-0552: Bind variable "EMPNO" not declared.

Status
Not open for further replies.

bhachi

Technical User
Jun 18, 2003
5
0
0
US
Hi,
In Oracle(sql) I have created a table "empl" as
sql>create table empl(
2 empno number(6),
3 empname varchar2(10),
4 location varchar2(10)
5 );
The description of the table is like this
sql>desc empl;
Name Null? Type
----------------------------- -------- ----------
EMPNO NUMBER(6)
EMPNAME VARCHAR2(10)
LOCATION VARCHAR2(10)

Now when I am trying to insert the values(multiple rows continuosly with /) I tried the following statement which I think is correct.
sql> insert into empl values(
2 &empno,'&empname',&location');

but here it is giving an error saying
SP2-0552: Bind variable "EMPNO" not declared.

Correct me if I am wrong.
And when I am inserting single row with this statement
sql> insert into empl values(1234,'Name','India');
1 row created.
It is fine.
Please throw some light on this.
 
BHachi,

When I ran (nearly) the same code as in your post, my results were successful:
Code:
SQL> create table empl(
  2   empno number(6), 
  3   empname varchar2(10),
  4   location varchar2(10)
  5   );

Table created.

SQL> desc empl
 Name                           
 --------------------------
 EMPNO                          
 EMPNAME                        
 LOCATION                       

SQL> insert into empl values(
  2   &empno,'&empname','&location');
Enter value for empno: 1234
Enter value for empname: Name
Enter value for location: India

1 row created.

SQL> /
Enter value for empno: 2345
Enter value for empname: Name2
Enter value for location: USA

1 row created.

SQL> /
Enter value for empno: 4567
Enter value for empname: Name3
Enter value for location: Canada

1 row created.

SQL> select * from empl;

     EMPNO EMPNAME    LOCATION
---------- ---------- ----------
      1234 Name       India
      2345 Name2      USA
      4567 Name3      Canada

3 rows selected.
The only difference between my code and the code you posted was that I fixed the missing quote in front of "...&location');". And the missing quote would not cause the error message you received.

There is something missing from the scenario you present above. Could you please place your entire scenario in a script file (.sql), re-run it (with "set echo on" and "set feedback on"), then copy and paste the run in a new reply to your thread?

Cheers,

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 20:07 (25Dec03) GMT, 13:07 (25Dec03) Mountain Time)
 
Thanks Mufasa for your clarification, but the thing is that syntax error is mistyped by me.Sorry for that.The same script is running fine for other database users.Don't know why is this happening particular to this database.
Will shoot it again in another angle.
Once again thanks for your valuable time.
If you find any solution other than this, please let me know
Thanks
Bhachi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top