cmleung2
asked on
pl/sql column name is name, cannot use update statement
Is there a way to wrap the name of the column in pl/sql for Oracle 9i?
I have this table that has a column name NAME. The select statement is ok, but the update statement gives me invalid identifer error. If I put single quote around it, it doesn't compare the condition where name = 'abc' correctly. What can I do other than alter the name of the column and alter back? Thanks.
I have this table that has a column name NAME. The select statement is ok, but the update statement gives me invalid identifer error. If I put single quote around it, it doesn't compare the condition where name = 'abc' correctly. What can I do other than alter the name of the column and alter back? Thanks.
I am not sure, but do you have table called NAME also you have column called NAME?
Can you check by running this query?
SELECT * FROM USER_OBJECTS
WHERE OBJECT_NAME = 'NAME'
Can you check by running this query?
SELECT * FROM USER_OBJECTS
WHERE OBJECT_NAME = 'NAME'
Try this:
create table temp (name varchar2(10));
insert into temp values ('test');
select * from temp;
update temp
set "NAME" = 'it works'
where "NAME" = 'test';
select * from temp;
create table temp (name varchar2(10));
insert into temp values ('test');
select * from temp;
update temp
set "NAME" = 'it works'
where "NAME" = 'test';
select * from temp;
Well, I do not see use of double quotes here (")
My try:
My try:
create table temp1 (name varchar2(10));
insert into temp1 values ('test');
select * from temp1;
update temp1
set NAME = 'it works'
where NAME = 'test';
>>Well, I do not see use of double quotes here (")
I don't either but the asker says they want them for some reason.
That said: jm76430,
I believe double quotes has already been mentioned.
I don't either but the asker says they want them for some reason.
That said: jm76430,
I believe double quotes has already been mentioned.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can try like this
update yourtable
set yourtable.Name = 'somevalue'
where yourtable.Name = 'something'
update yourtable
set yourtable.Name = 'somevalue'
where yourtable.Name = 'something'
ASKER
No I wasn't trying to do the dynamic sql, but I guess I have to now, and it works. thanks.
Select "NAME" from table.