Home » SQL & PL/SQL » SQL & PL/SQL » pl/sql insert problem.
pl/sql insert problem. [message #39553] Tue, 23 July 2002 07:14 Go to next message
sn008
Messages: 7
Registered: July 2002
Junior Member
Is there a solution to this ongoing problem..

SQL> l
1 DECLARE
2 -- Customer phone data.
3 v_cust_id CHAR(5) := chr(39)||&v_cust_id||chr(39);
4 v_simno VARCHAR2(10) := chr(39)||&v_simno||chr(39);
5 v_dirno VARCHAR2(12) := chr(39)||&v_dirno||chr(39);
6 BEGIN
7 insert into directory
8 ( DCID, SIMNO, DIRNO )
9 values
10 ( v_cust_id, v_simno, v_dirno );
11* END;
SQL> /
Enter value for v_cust_id: '10004'
old 3: v_cust_id CHAR(5) := chr(39)||&v_cust_id||chr(39);
new 3: v_cust_id CHAR(5) := chr(39)||'10004'||chr(39);
Enter value for v_simno: 'ER34UIT09'
old 4: v_simno VARCHAR2(10) := chr(39)||&v_simno||chr(39);
new 4: v_simno VARCHAR2(10) := chr(39)||'ER34UIT09'||chr(39);
Enter value for v_dirno: '978-929-9201'
old 5: v_dirno VARCHAR2(12) := chr(39)||&v_dirno||chr(39);
new 5: v_dirno VARCHAR2(12) := chr(39)||'978-929-9201'||chr(39);
DECLARE
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 3
Re: pl/sql insert problem. [message #39555 is a reply to message #39553] Tue, 23 July 2002 07:24 Go to previous messageGo to next message
Epe
Messages: 99
Registered: March 2002
Member
You're putting 10004 which is already 5 long + twice a quote (so in total 7 long) into a char(5) field...
Re: pl/sql insert problem. [message #39560 is a reply to message #39553] Tue, 23 July 2002 08:34 Go to previous message
sn008
Messages: 7
Registered: July 2002
Junior Member
The single quotes chr(39) is not a input to the field but enclosed with character input ..But I understand your point...how do I insert only the value and not the single quotes.

For example: 'Customer number'
Previous Topic: group by question
Next Topic: Cursor in PL/SQL not sorted based on input parameter
Goto Forum:
  


Current Time: Fri Apr 26 17:52:05 CDT 2024