Inserting '&' into a table

Rahul

Member
Hi

I m giving a 'INSERT' statement in PL/SQL. The value I m inserting is given below

"http://account.aspx?ID=1234&STATUS=TRUE"

I m not using any front end UI to do the job. I want to insert this value into the DB table using a INSERT statement in the PL/SQL. But I m having problem with the '&' sign.

I want to write a trigger, which replaces the '&' with '&&'. I tried, but its not working

Can anyone guide me on this ?

Thanking in advance
 
You are doing this in PL/SQL, so I assume you have a stored program unit or an Anonymous PL/SQL Block that does this? If so, how you you compile/execute it?
 
One way is:

SQL>
SQL> set define off;
SQL> insert into marc_test
2 (dummy)
3 values
4 ('TEST & TEST');

1 row inserted

SQL>

If you must do this from PL/SQL, you can put it into a variable and use the execute immediate option.

Marc
 
Hi Marco what means your footer :

Java maakt meer kapot dan je lief is

as i am german i understand :

Java macht mehr kaputt als ...

Greetings
Karl
 
Rahul: I want to do the above in a trigger

Code:
drop table tb_amp;
Table dropped

create table tb_amp(
    id integer,
    url varchar2(100)
);
Table created

create or replace trigger tr_amp
      before insert on tb_amp
      for each row
declare
    l_param varchar2(10) := 'debug=yes';
begin
    :new.url := :new.url || '&' || l_param;
end tr_amp;
/
Trigger created

insert into tb_amp values (1, 'http://www.allroundautomations.com/ubb/ultimatebb.php?ubb=forum;f=3');
1 row inserted

select * from tb_amp;
ID URL
-- --------------------------------------------------------------------------------
 1 http://www.allroundautomations.com/ubb/ultimatebb.php?ubb=forum;f=3&debug=yes
 
Back
Top