ABAP顾问
分类:
2010-05-07 23:23:13
REPORT z_barry_test NO STANDARD PAGE HEADING .
DATA: str1(128),str2(128),str3(128).
***
str2 = '20080109'.
EXEC SQL.
* SELECT to_char(to_date('20080109','yyyymmdd'),'ww') from dual into :str1
SELECT to_char(to_date(:str2,'yyyymmdd'),'ww') from dual into :str1
ENDEXEC.
WRITE / str1.
***
str2 = '123,456.78'.
EXEC SQL.
* select to_number('$123,456.78','$999,999,999,999.99') from dual into :str1
select to_number(:str2,'999,999,999,999.99') from dual into :str1
ENDEXEC.
WRITE / str1.
***
str2 = 'B'.
EXEC SQL.
* select ascii('A') from dual into :char
select ascii(:str2) from dual into :str1
ENDEXEC.
WRITE / str1.
***
EXEC SQL.
select rawtohex(sys_guid()) from dual into :str1
ENDEXEC.
WRITE / str1.
***
str2 = '65'.str3 = '66'.
EXEC SQL.
* select CHR(65)||CHR(66) from dual into :str1
select CHR(:str2)||CHR(:str3) from dual into :str1
ENDEXEC.
WRITE / str1.
***
str2 = '20090507 23:19:20'.
EXEC SQL.
* select to_char(sysdate-10,'YYYYMMDD HH24:MI:SS') from dual into :str1
select to_char(to_date(:str2,'yyyymmdd hh24:mi:ss')-10,'YYYYMMDD HH24:MI:SS') from dual into :str1
ENDEXEC.
WRITE / str1.
***
EXEC SQL.
select user from dual into :str1
ENDEXEC.
WRITE / str1.