You are trying to update the result of a function here, and that is not allowed.
If you need to apply a function, then you should apply it to the new value you want to assign to the column, not to the column itself.
Last Wiki Answer Submitted: January 5, 2010 2:31 pm by carlosdl63,535 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
Oracle 10g
OPERATOR is the Object
REVOKFLG is a field that’s of CHAR type. either 0 or 1.
I am trying to update the REVOKFLG which is displayed in ascii as ’0′ (flag uncheck).
SQL> update operator set REVOKFLG=char(0) where login like ‘ospprov’;
update operator set REVOKFLG=char(0) where login like ‘ospprov’
*
ERROR at line 1:
ORA-00936: missing expression
I had tried that earlier which actually made me ask questions about this.
Unfortunately when I checked again by querying ( SELECT ascii(REVOKFLG) from OPERATOR where login like ‘ospprov’;) , REVOKFLG is (48) and not (0).
For this I want to know if there is something I am missing?
Yes, you get 48, because 48 is the code for the ’0′ character.
Could you please explain why you need to use
SELECT ASCII(REVOKFLG)
instead of simply:
SELECT REVOKFLG
to get 0 as result ?
There is no printable character for the ascii code 0. This code represents the null character, so I can’t think of a way to get 0 when asking for the ascii code of REVOKFLG.
You can use a number stored in a char column as a number (and not as a character) without any problems (and w/o the need of the ASCII function), or you could use a column of type NUMBER(1) if you feel more comfortable with it.
I’m sure there is something that needs clarification here. Please provide as much deatils as possible about your requirement.
What database platform are you using?
Oracle 10g
OPERATOR is the Object
REVOKFLG is a field that’s of CHAR type. either 0 or 1.
I am trying to update the REVOKFLG which is displayed in ascii as ’0′ (flag uncheck).
SQL> update operator set REVOKFLG=char(0) where login like ‘ospprov’;
update operator set REVOKFLG=char(0) where login like ‘ospprov’
*
ERROR at line 1:
ORA-00936: missing expression
Please how can I update this?
Am I missing something ?
I had tried that earlier which actually made me ask questions about this.
Unfortunately when I checked again by querying ( SELECT ascii(REVOKFLG) from OPERATOR where login like ‘ospprov’;) , REVOKFLG is (48) and not (0).
For this I want to know if there is something I am missing?
Yes, you get 48, because 48 is the code for the ’0′ character.
Could you please explain why you need to use
SELECT ASCII(REVOKFLG)
instead of simply:
SELECT REVOKFLG
to get 0 as result ?
There is no printable character for the ascii code 0. This code represents the null character, so I can’t think of a way to get 0 when asking for the ascii code of REVOKFLG.
You can use a number stored in a char column as a number (and not as a character) without any problems (and w/o the need of the ASCII function), or you could use a column of type NUMBER(1) if you feel more comfortable with it.
I’m sure there is something that needs clarification here. Please provide as much deatils as possible about your requirement.