![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi all This might be an FAQ question, so apologies if it's something very fundamental. I've looked through the Oracle documentation, and spent some considerable time scanning Google Groups, but I haven't found anything that deals specifically with the problem that I'm having. One of my tables has a 'URI' column of TEXT type - and I'm having difficulties with some of the values that I'm trying to enter from SQL*Plus under Oracle 8.0 Personal Edition. For example, one of the URL's looks like: http://www.websitename.com/forums/register.php?s=&action=signup' The SQL I'm using looks like this: INSERT INTO contact VALUES (4, 'http://www.websitename.com/forums/register.php?s=&action=signup') ...and when I submit it I get a prompt which says "Enter value for action:" If I just press [return]: old 2: (4, 'http://www.websitename.com/forums/register.php?s=&action=signup') new 2: (4, 'http://www.websitename.com/forums/register.php?s==signup') ...with the '&action' part removed. Can someone explain what's going on here? Do I need to escape any '&' string segments somehow? Many thanks in advance David |
#2
| |||
| |||
|
|
Before issuing your statement, in SQL*Plus, enter the command set define off SQL*Plus treats the & character as the start of a varialbe name. Set define off disables this behavior. "David Hall" <noone (AT) nowhere (DOT) com> wrote in message news:bf9bhf$m89$1 (AT) newsg1 (DOT) svr.pol.co.uk... Hi all This might be an FAQ question, so apologies if it's something very fundamental. I've looked through the Oracle documentation, and spent some considerable time scanning Google Groups, but I haven't found anything that deals specifically with the problem that I'm having. One of my tables has a 'URI' column of TEXT type - and I'm having difficulties with some of the values that I'm trying to enter from SQL*Plus under Oracle 8.0 Personal Edition. For example, one of the URL's looks like: http://www.websitename.com/forums/register.php?s=&action=signup' The SQL I'm using looks like this: INSERT INTO contact VALUES (4, 'http://www.websitename.com/forums/register.php?s=&action=signup') ...and when I submit it I get a prompt which says "Enter value for action:" If I just press [return]: old 2: (4, 'http://www.websitename.com/forums/register.php?s=&action=signup') new 2: (4, 'http://www.websitename.com/forums/register.php?s==signup') ...with the '&action' part removed. Can someone explain what's going on here? Do I need to escape any '&' string segments somehow? Many thanks in advance David |
#3
| |||
| |||
|
|
"David Hall" <noone (AT) nowhere (DOT) com> wrote in message news:bf9bhf$m89$1 (AT) newsg1 (DOT) svr.pol.co.uk... Hi all --snip-- The SQL I'm using looks like this: INSERT INTO contact VALUES (4, 'http://www.websitename.com/forums/register.php?s=&action=signup') ...and when I submit it I get a prompt which says "Enter value for action:" --snip-- Many thanks in advance David Its a FAQ all right. I'll copy paste from my earlier reply (You could have found this yourself by searching for "oracle ampersand") Choose your way: SQL> create table x (a varchar2(10)); Table created. SQL> insert into x values ('a'||chr(38)||'b'); 1 row created. SQL> set escape on SQL> insert into x values ('x\&y'); 1 row created. SQL> set escape off SQL> set define ^ SQL> insert into x values('m&n'); 1 row created. SQL> select * from x; A ---------- a&b x&y m&n .... or you can simply: "set define off" Anurag |
#4
| |||
| |||
|
|
But he would have had to have known that the ampersand was the problem to know to search on "ampersand". .. true. But then he could have searched for "oracle prompt" or "oracle
|
![]() |
| Thread Tools | |
| Display Modes | |
| |