Inserting list of string values which has &'s into a columns. [message #369909] |
Mon, 06 November 2000 12:17 |
Nirmal
Messages: 39 Registered: November 2000
|
Member |
|
|
I have a list of string values eg.:
'asdasdj&asd&kasl'
'kjasdj&lasdk%lkas&kasjd'kjasd'
When i try to insert it into the table let's say table a:
insert into a values('asdasdj&asd&kasl');
this prompts me to enter the values:
How do I get around this..
Please don't tell me to do this :
insert into a values('asdasdj'||'&'||'asd'||'&'||'kasl');
Because these string values comes from a file, and i generate the insert script on the fly..
Thanks in adv.
Nirmal
|
|
|
|
|
|
|
|
Re: Inserting list of string values which has &'s into a columns. [message #369984 is a reply to message #369913] |
Wed, 22 November 2000 09:17 |
Madhav Kasojjala
Messages: 42 Registered: November 2000
|
Member |
|
|
Hi Nirmal,
I don't know how you are doing inserts.
But if ur situation allows u to use a PLSQL block or function which will give u clean string then
u can do this way....
vStr is ur input string,
From ASCII Char set 39 is for '.
Let me know if u have diff. situation
declare
vStr varchar2(2000):=NULL;
vLen Number(10) :=0;
begin
vLen := length(vStr);
for i in 1..vLen
loop
if ascii(substr(vStr,i,1)) = 39 then
vStr :=substr(vStr,1,i-1)||''||substr(vStr,i+1,length(vStr));
end if;
end loop;
end;
|
|
|
|
|
|
Re: Inserting list of string values which has &'s into a columns. [message #370027 is a reply to message #369913] |
Thu, 30 November 2000 12:36 |
Mohammad Syed
Messages: 18 Registered: November 2000
|
Junior Member |
|
|
Ok lets say that your working on a database for a a food wholesale distributer. You want to run the following query
SELECT
item,
price,
quantity,
bulkdiscount
FROM
wholesales
WHERE shipdate = sysdate
AND customer = 'A&P'; -- The string in question
..In this silly example, the where clause would prompt a value for the client rather than find 'A&P'. I want the string and not the prompt.
|
|
|
|
|
|
|