sql - SAS to Oracle: ORA-00920: invalid relational operator -
running code in sas oracle:
rsubmit; proc sql; &c_oradb; create table immb select * connection oracle (select b.id, b.sysdate, case when id>0 'imm' end source /*creating variable label source file */ hpmdcd a, omdb.medta b a.code=b.code , '1/1/2008'd =< sysdate <= '12/31/2016'd order id, sysdate); disconnect oracle; quit; i following error:
error: oracle prepare error: ora-00920: invalid relational operator. sql statement
and '1/1/2008'd =< sysdate <= '12/31/2016'd there 3 things wrong statement.
- you can't use 2 relational operators together. use between
dafter date not required work column alias may needed in select not while comparing.- comparing
stringdatenot correct.
use
and sysdate between date '2008-01-01' , date '2016-12-31' date '2008-01-01' equivalent to_date('2008-01-01','yyyy-mm-dd')
also, although won't give error, instead of using classing comma separated tables, use proper join syntax. like.
from table1 t1 join table2 t2 on t1.somecolumn=t2.somecolumn i looking sql query. not sure on sas part.
Comments
Post a Comment