Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: 'ORA-01756: quoted string not properly terminated'

Re: 'ORA-01756: quoted string not properly terminated'

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Sat, 16 Jun 2007 22:06:25 +0200
Message-ID: <467442C1.5000807@gmail.com>


sanjeev.atvankar_at_gmail.com schrieb:
> Hi Gurus,
>
> I have table as follows
>
> create table T1
> (
> id number,
> name varchar2(30)
> )
>
> I have written the Code as follows
>
> decalre
> emp_rec emp%rowtype;
> cursor c1 is select empno,ename from emp;
> begin
>
> open c1;
> fetch c1 into emp_rec;
> while c1%found
> loop
> insert into T1 (id,name) values(emp_rec.id,emp_rec.name);
> end loop;
>
> commit;
> end;
>
> I have following data in emp table
>
> empno ename
> ------------------------------
> 1 Sanjeev
> 2 Smith
> 3 Scott
> 4 D'Costa
>
> empno 1,2 and 3 are inserted properly.
>
> But when I tried to insert empno 4 it gives me the following error.
> 'ORA-01756: quoted string not properly terminated'
> i.e. when Cursor (emp_rec.name=D'Costa) contains the value as D'Costa.
>
> If it is manually then I can insert as D''Costa but How would i do
> this when dynamically.
>
> Thanking in Advance
> Sanjeev
> sanjeev.atvankar_at_gmail.com
>

If not only guru's are allowed, when i'd try. 1) You stated nonexistent problem, what is your real problem? 2) You provided non working examples, which is wrong at least at following places:
a) your emp_rec has more fields than cursor, so you can't fetch it into this record.
b) you coded endless loop ( not fetching within it) c) your insert can't work because you reference record fields, which your record doesn't have.
d) you are claiming that a varchar2 variable containing string with a ' can't be inserted due to ORA-01756, which is simply not true.

Then, may i ask, what was the goal of this post?

Best regards

Maxim
PS *decalre* is written normally as *declare* Received on Sat Jun 16 2007 - 15:06:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US