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: joel garry <joel-garry_at_home.com>
Date: Mon, 18 Jun 2007 13:26:23 -0700
Message-ID: <1182198383.214304.48330@z28g2000prd.googlegroups.com>


On Jun 16, 8:49 am, sanjeev.atvan..._at_gmail.com wrote:
> 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.atvan..._at_gmail.com

Besides, you probably should ask if you should be committing in a loop. http://orafaq.com/faq/how_often_should_one_commit_in_a_pl_sql_loop_what_is_the_best_commit_strategy http://www.oracle.com/oramag/oracle/01-jul/o41asktom.html http://www.dbasupport.com/oracle/ora9i/DeleteHistoricalData02.shtml

jg

--
@home.com is bogus.
http://www.cooltechzone.com/Departments/Columns/The_Psychology_of_Mac_Zealots_200706182866/
Received on Mon Jun 18 2007 - 15:26:23 CDT

Original text of this message

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