declare x varchar2(100); begin execute immediate 'select hospital_id||to_char(||trnx_date,'mmddyyyy')||patient_case_type from SJHS_ADT_ACT_TRXMST_BAK ;' into x; dbms_output.put_line(x); end; * ERROR at line 5: ORA-06550: line 5, column 61: PLS-00103: Encountered the symbol "MMDDYYYY" when expecting one of the following: . ( * @ % & = - + ; < / > at in is mod not rem return returning <an exponent (**)> <> or != or ~= >= <= <> and or like between into using || bulk The symbol ". was inserted before "MMDDYYYY" to continue. Here i am missing something with the MMDDYYYY format and its string. Somany trials. but did not work. Can u please help me how to convert the date to_char in exec immediate. Raj Igor Neyman <ineyman@xxxxxxxxxxxxxx> wrote: Multiple errors in your code. This will work: set serveroutput on declare lDate DATE; begin execute immediate 'select sysdate from dual' into lDate; dbms_output.put_line(lDate); end ; / Read Oracle docs. --------------------------------- From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of raja rao Sent: Tuesday, January 24, 2006 8:22 AM To: oracle list Subject: exec immediate Hi Team, when the below is run i am getting the error. can someone help me : begin execute immediate ' select sysdate from dual ;' end ; * ERROR at line 3: ORA-06550: line 3, column 1: PLS-00103: Encountered the symbol "END" when expecting one of the following: . ( * @ % & = - + ; < / > at in is mod not rem return returning <an exponent (**)> <> or != or ~= >= <= <> and or like between into using || bulk The symbol ";" was substituted for "END" to continue. --------------------------------- What are the most popular cars? Find out at Yahoo! Autos --------------------------------- Yahoo! Photos Got holiday prints? See all the ways to get quality prints in your hands ASAP.