Kindly help ORA-00917: missing comma" ERR-1101 Unable to process function

HI Experts,
Since yesterday every thing was fine, i do not know what happened in the evening, we are facing some issue with our production.
I'm getting the following error ,when i running the report
ORA-00917: missing comma
     Error      ERR-1101 Unable to process function body returning query.
Since long time we have even not touched the code , i'm wondering about this error...the same code was working fine just 2 days back.
Kindly help me with this...
Code
DECLARE
   date_from DATE:=:P46_TRANS_DATEFROM;
   date_to DATE:=:P46_TRANS_DATETO;
   --date_from DATE :=TO_DATE('22-Nov-2007','DD-Mon-yyyy');
   --date_to DATE :=TO_DATE('23-Nov-2007','DD-Mon-yyyy');
   date_counter DATE:=date_from;
   v_city varchar2(32):=:P46_CITY;
   str_month1 VARCHAR2(3):=SUBSTR(TO_CHAR(date_from,'DD-MON-YYYY'),4,3);
   str_year1 VARCHAR2(4):=SUBSTR(TO_CHAR(date_from,'DD-MON-YYYY'),8,4);
   str_month2 VARCHAR2(3):=SUBSTR(TO_CHAR(date_to,'DD-MON-YYYY'),4,3);
   str_year2 VARCHAR2(4):=SUBSTR(TO_CHAR(date_to,'DD-MON-YYYY'),8,4);
   day_from VARCHAR2(2):=SUBSTR(date_from,1,2);
   day_to VARCHAR2(2):=SUBSTR(date_to,1,2);
   CURSOR trans_alloc(m VARCHAR2,y NUMBER,email VARCHAR2) IS SELECT * FROM EFT_TRANS_ALLOCATION WHERE LOWER(MONTH)=LOWER(m) AND YEAR=y AND LOWER(email_id)=LOWER(email);
   CURSOR trans_schedules(m1 VARCHAR2,y1 NUMBER,m2 VARCHAR2,y2 NUMBER) IS SELECT * FROM OD_SHIFT_SCHEDULE WHERE (UPPER(MONTH)=m1 OR UPPER(MONTH)=m2) AND (YEAR=y1 OR YEAR=y2);
   CURSOR get_res_id(email VARCHAR2) IS SELECT resource_id,first_name,last_name FROM EFT_RESOURCES WHERE LOWER(email_id)=LOWER(email);
   rec OD_SHIFT_SCHEDULE%ROWTYPE;
   CURSOR get_shifts(id VARCHAR2) IS SELECT * FROM OD_SHIFTS WHERE shift_id=id;
   ta EFT_TRANS_ALLOCATION%ROWTYPE;
   sd OD_SHIFTS%ROWTYPE;
   sql_str VARCHAR2(4000);
   v_res_id NUMBER;
   v_fname VARCHAR2(50);
   v_lname VARCHAR2(50);
   v_shift_id VARCHAR2(32);
   s VARCHAR2(1000);
   d VARCHAR2(32);
   final_sql VARCHAR2(4000);
   v_consent VARCHAR2(3);
   s2 VARCHAR2(1000);
   dn DATE;
BEGIN
   DELETE FROM EFT_SHIFT_SCHEDULES_RPT;
   OPEN trans_schedules(UPPER(str_month1),TO_NUMBER(str_year1),UPPER(str_month2),TO_NUMBER(str_year2));
   LOOP
      FETCH trans_schedules INTO rec;
       EXIT WHEN trans_schedules%NOTFOUND;
       OPEN get_res_id(rec.name);
       FETCH get_res_id INTO v_res_id,v_fname,v_lname;
          OPEN trans_alloc(TO_CHAR(date_counter,'MON'),TO_NUMBER(TO_CHAR(date_counter,'YYYY')),rec.name);
           FETCH trans_alloc INTO ta;
           IF trans_alloc%FOUND THEN
           dbms_output.put_line (date_counter||'----'||date_to||'Res_id:----'||v_res_id||'-'||ta.slno);
           dbms_output.put_line ('Found Alloc');
           WHILE date_counter<=date_to
           LOOP
                --d:=d||'-'||str_month||'-'||str_year;
                d:=SUBSTR(TO_CHAR(date_counter,'DD-MON-YYYY'),1,2);     
                s:='INSERT INTO temp_2 SELECT "'||d||'" from OD_SHIFT_SCHEDULE where slno='||rec.slno;
                --dbms_output.put_line (d||'-'||s);
                DELETE FROM temp_2;
                EXECUTE IMMEDIATE s;
                SELECT substr(trim(VAL),1,1) INTO v_shift_id FROM temp_2;
                s2:='INSERT INTO temp_3 SELECT "'||d||'" from EFT_TRANS_ALLOCATION where slno='||ta.slno;
                DELETE FROM temp_3;
                EXECUTE IMMEDIATE s2;
                SELECT VAL INTO v_consent FROM temp_3;
                --dbms_output.put_line (v_shift_id||'-'||v_consent);
                --dbms_output.put_line (date_counter||'-'||date_to);
                IF v_consent='Y' THEN
                --dbms_output.put_line ('Im inside consent'||v_consent);
                IF v_shift_id IS NOT NULL THEN
                --dbms_output.put_line ('Im inside shift not null'||v_shift_id);
                   OPEN get_shifts(v_shift_id);
                   FETCH get_shifts INTO sd;
                    IF sd.night_shift_indicator='Y' THEN
                       dn:=date_counter+1;
                    sql_str:='INSERT INTO eft_shift_schedules_rpt VALUES ('||v_res_id||','''||v_fname||''','''||v_lname||''','''||rec.name||''','''||sd.shift_name||''','''||date_counter||''','''||sd.start_from||''','''||sd.start_to||''','''||''','''||sd.active_yn||''','''||dn||''')';
                    ELSE
                       sql_str:='INSERT INTO eft_shift_schedules_rpt VALUES ('||v_res_id||','''||v_fname||''','''||v_lname||''','''||rec.name||''','''||sd.shift_name||''','''||date_counter||''','''||sd.start_from||''','''||sd.start_to||''','''||''','''||sd.active_yn||''','''||date_counter||''')';
                    END IF;
                   EXECUTE IMMEDIATE sql_str;
                   CLOSE get_shifts;
                    --dbms_output.put_line (sql_str);
                END IF;
                END IF;
                COMMIT;
                date_counter:=date_counter+1;     
          END LOOP;
           END IF;
      CLOSE trans_alloc;
       CLOSE get_res_id;
       --dbms_output.put_line (rec.name);
       date_counter:=date_from;
   END LOOP;
   COMMIT;
   CLOSE trans_schedules;
final_sql:='select a.first_name,a.last_name,a.email_id,a.shift_details,a.arrange_date,a.slot_from,a.slot_to,a.trans_arranged,a.active_yn,b.address1,b.address2,b.city,b.state,b.pin,b.worknumber,b.homenumber,b.mobilenumber,a.to_date from eft_shift_schedules_rpt a,eft_locations b where a.resource_id=b.resource_id and b.city =:P46_CITY';
--dbms_output.put_line (final_sql);
RETURN final_sql;
END;

Hi Basva,
my best advice is find out where the error happens, e.g. using DBMS_UTILITY.FORMAT_ERROR_BACKTRACE .
In the next step you can fix the error and rework the code so that it looks nice and has some comments in it so everyone knows what it SHOULD do.
brgds,
Peter
Blog: http://www.oracle-and-apex.com
ApexLib: http://apexlib.oracleapex.info
BuilderPlugin: http://builderplugin.oracleapex.info
Work: http://www.click-click.at and http://www.wirsindapex.at

Similar Messages

  • ORA-00917: missing comma when using NVL

    Hi All,
    I have a INSERT statement which works fine and looks something like:
    EXECUTE IMMEDIATE
    'insert into MYTABLE(ID,TASK_ROLE, PROGRESS,SALES_PERSON) values ...
    However if I change the above piece to use NVL function like this:
    EXECUTE IMMEDIATE
    'insert into MYTABLE(ID,TASK_ROLE, NVL(PROGRESS,''0''),SALES_PERSON) values ...
    I am getting the following error:
    ORA-00917: missing comma
    Where should I enter the extra comman needed?
    Regards,
    Pawel.

    Hi these are in fact two simple quotes '. If I use only one simple quote I get an error:
    1 error has occurred
    ORA-06550: line 48, column 239: PLS-00103: Encountered the symbol "0" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem return returning <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between into using || multiset bulk member SUBMULTISET_ The symbol "* was inserted before "0" to continue.
    Same thing happens if I ommit the quotes at all and leave it like NVL(PROGRESS,0)
    Edited by: padmocho on Sep 20, 2010 11:37 AM

  • Error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-00917: missing comma

    hi
    i dont no why this error is coming. error may b while storing chaacter array in database
    program is
    //TCPClient.java
    import java.io.*;
    import java.net.*;
    import java.util.Calendar;
    import java.text.SimpleDateFormat;
    import java.sql.*;
    import javax.swing.*;
    class Client
         protected DataInputStream in;
    protected DataOutputStream out;
    //Jframe frame;
    public static final String DATE_FORMAT_NOW = "yyyy/MM/dd HH:mm:ss";
    public static String now() {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    return sdf.format(cal.getTime());
    public static void main(String argv[]) throws Exception
    String FromServer;
    String ToServer;
    int i=0;
    // frame = new JFrame("Show Message Dialog");
    Socket clientSocket = new Socket("localhost", 5000);
    BufferedReader inFromUser =
    new BufferedReader(new InputStreamReader(System.in));
    PrintWriter outToServer = new PrintWriter(
    clientSocket.getOutputStream(),true);
    BufferedReader inFromServer = new BufferedReader(new InputStreamReader(
    clientSocket.getInputStream()));
    String d=(Client.now());
    try{
    String cmd = "reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\"";
         Process p = Runtime.getRuntime().exec(cmd);
    Thread.sleep(200l); //terrible, the right way is p.waitFor
    InputStream in = p.getInputStream();
    byte[] bytes = new byte[16384];
    StringBuffer buf = new StringBuffer();
    while(true) {
    int num = in.read(bytes);
    if(num == -1) break;
    buf.append(new String(bytes,0,num,"UTF-8"));
    //output stored in a string
    System.out.println(buf.toString());
    String str=new String();
    str=(buf.toString());
    //formating output
    String newtext=str.replaceAll("HKEY_LOCAL_MACHINE","");
    String newtext1=newtext.replaceAll("SOFTWARE","*");
    System.out.println(newtext1);
    //getting local ip
    InetAddress thisIp =InetAddress.getLocalHost();
    String ip=(thisIp.getHostAddress());
    System.out.println("IP:"+thisIp.getHostAddress());
    // printing date and time
    System.out.println(d);
    // connection
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn=DriverManager.getConnection("jdbc:odbc:cat","system","root");     
              PreparedStatement ps=conn.prepareStatement("select ip,dates,software from ipdet");
    ResultSet r=ps.executeQuery();
    char softlist[]=newtext1.toCharArray();
         for(i=0;i<softlist.length;i++)
    if(softlist=='*')
    System.out.println("\n");
         System.out.print(softlist[i]);
              Statement s=conn.createStatement();
              String ins="insert into ipdet(ip,dates,software) values(ip,d,softlist[i])";
              s.executeUpdate(ins);
    // s.setString(1,ip);
              //s.setString(2,d);
                   // s.setString(3,softlist[i]);
                   // s.executeUpdate();
    System.out.println("record inserted succcessfully") ;
              r.close();
              conn.close();
              clientSocket.close();
    catch (Exception e)
    System.err.println("Error: " + e.getMessage());

    i don't think its your connection. You must be hitting the DB otherwise you would not be getting an ORA error returned wrapped in an SQLException. I think its your pseudo-SQL, it simply says that you are missing a comma in an update string. Realistically, it could be that it is being misled into looking for a comma, probably because you have put a ';' at the end of your update string...

  • ORA-00917: missing comma

    Hello again,
    I am here because I know I am missing something. I see I have a comma after every column name in the INSERT clause, and in the VALUES clause I put commas after the values for the corresponding columns.
    Even if you don't tell me the exact reason, I'd appreciate any guidance to find out where my syntax is wrong.
    Here is my code:
    INSERT INTO appeals (appeal_id, crime_id, status, TO_CHAR(filing_date, 'MONTH DD YYYY')"Filing_Date",
    TO_CHAR(hearing_date, 'MONTH DD YYYY')"Hearing_Date")
    VALUES(APPEALS_ID_SEQ.NEXTVAL, :crime_id, '', :filing_date, :hearing_date);
    Thanks!

    Your syntax is wrong - it goes:
    insert into <table>[(columnlist)]
    values([valuelist])You are putting the to_char in the wrong spot. You can't put it in the column list - it needs to go in the values list. And to enter data into a date column, you want to_date. You want to convert a character string into its date representation.
    Like
    insert into table (co1, col2, col3)
    values('ABC', to_date(:someval, 'DD/MM/YYYY'), to_date(:otherval, 'DD/MM/YYYY'))

  • EncounteringERR-1101 Unable to process function body returning query

    hi,
    I am new to APEX and finding some difficulties while developing an application. My application chooses a value from a dropdown, and depending on the value chosen, adds some columns in the report.
    The code is somewhat like below:
    DECLARE
    --variable declaration for col headers for ports
    l_p_name ports_ver.port_name%TYPE;
    l_id ports_ver.port_id%TYPE;
    type pstr is varray(25) of varchar2(100);
    nm pstr;
    hdr varchar2(1000);
    chd varchar2(100);
    msg varchar2(6000);
    msg1 varchar2(6000);
    h varchar2(60);
    begin
    l_p_name := :PR_VALUE; ----the dropdown value
    msg := 'select 1 "Edit" , p.ID "ID",p.TEST_MANAGER "Manager",p.AREA_NAME "Area", p.COMPONENT "Component", v.port_name "Port",';
    select version
    bulk collect into nm
    from ports_ver
    where port_name=l_p_name;
    for i in nm.first..nm.last
    loop
    select get_col_head(l_p_name,nm(i)) into hdr from dual;
    chd := 'Tstng Pltfrm '||nm(i);
    msg := msg||' hdr "'|| chd ||'", ';
    --msg1 := msg || 'null, ';
    end loop;
    msg1:= msg || 'p.imp_blk_bug "Blocking Bugs" , p.NUM_SCENARIOS "No of Scenarios" ,p.PASS "Pass", p.FAIL "Fail" ,p.COMPLETE "Complete" ,p.COMMENTS "Comment" ,v.version "VERSION" from PORT_FFT p,ports_fft_sts s ,ports_ver v
    where v.port_name = l_p_name ;';
    return msg1;
    end;
    can you point me some hints?

    Hi, and welcome!
    Firstly, you don't need to end the SQL statement with a semi-colon as you are returning a SQL query rather than PL/SQL code. So, change:
    where v.port_name = l_p_name ;';to:
    where v.port_name = l_p_name';Your SQL statement itself uses three tables, yet your WHERE clause only references two - is this intentional?
    Andy

  • Ora-00917 missing right paranthesis

    hi,
    pls help me to find the error in this query
    INSERT INTO champ.case_worker
    (case_worker_id,
    primary_role_id,
    worker_name,
    initials,
    short_name,
    mainframe_id,
    worker_status_code)
    VALUES
    (champ.case_worker_id_seq,
    14,
    IRTS (Issue Resolution Tracking System),
    IRTS,
    IRTS,
    IRTS)
    Message was edited by:
    user596307

    Sometimes the SQL compiler will shamelessly, well, lie to you about what the problem is. The missing "(" error is something that may have nothing whatsoever to do with the cited problem but some other structural problem

  • Anyone to help with this problem: ora-00922 : missing or invalid option

    I am trying to call a function that i wrote.
    PS: i am new to oracle functions.
    The purpose of this function is to display each item with its suppliers displayed in a record. I hope what i wrote in my function is close to what i am trying to get as a result.
    Here what i run:
    CREATE TYPE ind_tab_supplier0 AS OBJECT
    (ITP_SUPPLIER_CODE VARCHAR2(50),
    ITP_SUPPLIER_NAME VARCHAR2(50));
    CREATE TYPE ind_tab_supplier1 IS VARRAY(6) OF VARCHAR2(30);
    CREATE TYPE ind_tab_supplier_table AS TABLE OF ind_tab_supplier1;
    than i tried to execute the following function but it gave me the error
    "ora-00922 : missing or invalid option". If anyone could tell me what is wrong with it:
    CREATE OR REPLACE CSRDBA."GET_SUPPLIERS" (itemCode IN
    ref_item.itm_id%TYPE) RETURN ind_tab_supplier_table PIPELINED
    IS
    TYPE ref0 IS REF CURSOR;
    cur0 ref0;
    TYPE ref1 IS REF CURSOR;
    cur1 ref1;
    out_rec0 ind_tab_supplier0
    := ind_tab_supplier0(NULL,NULL);
    out_rec1 ind_tab_supplier1
    := ind_tab_supplier1(NULL);
    BEGIN
    v_itemCode := itemCode;
    OPEN cur0 FOR
    ' select t.ven_id , (select s.ven_name from ref_ven_vendor s '||
    'where s.ven_id = t.ven_id)
    "supplier_name" '||
    ' from ref_item_vendor t where t.itm_id = :1 '
    USING v_itemCode;
    LOOP
    FETCH cur0 INTO out_rec0.itp_supplier_code,
    out_rec0.itp_supplier_name;
    IF cur0%NOTFOUND THEN
    RETURN;
    END IF;
    out_rec1.ind_tab_supplier1.extend;
    out_rec1.ind_tab_supplier1(out_rec1.ind_tab_supplier1.count) :=
    out_rec0.itp_supplier_code;
    out_rec1.ITP_SUPPLIER.extend;
    out_rec1.ITP_SUPPLIER(out_rec1.ITP_SUPPLIER.count) :=
    out_rec0.itp_supplier_name;
    END LOOP;
    PIPE ROW(out_rec1);
    CLOSE cur0;
    RETURN;
    END GET_SUPPLIERS;
    At the end what i want to do is to run the following query if possible:
    select item_code, item_name, GET_SUPPLIERS( item_code )
    from item_table
    Thank you in advance for your help.

    Hi,
    Try this :
    While creating TYPE remove semi colon from end of the statement and also dont use extra / as / means execute last statement so you may encounter error..
    CREATE TYPE ind_tab_supplier1 IS VARRAY(6) OF VARCHAR2(30)
    /

  • Need help with ORA-00936: missing expression

    11.2.0.3
    desc killsessionlog
    Name                                                  Null?    Type
    KILLTIME                                              NOT NULL DATE
    USERNAME                                              NOT NULL VARCHAR2(30)
    SID                                                   NOT NULL NUMBER
    SERIAL#                                               NOT NULL NUMBER
    CTIME                                                 NOT NULL NUMBER
    MACHINE                                                        VARCHAR2(64)
    TERMINAL                                                       VARCHAR2(30)
    PROGRAM                                                        VARCHAR2(48)
    ACTION                                                         VARCHAR2(64)
    MODULE                                                         VARCHAR2(64)want to test the code to kill the blocker
    SQL> create or replace procedure killblocker
      2  is
      3  stmt varchar2(1000);
      4  cursor c1 is
      5  select  s1.SQL_EXEC_START+l1.ctime killtime, s1.username,s1.sid,s1.serial#,l1.ctime ,s1.machine
    ,s1.TERMINAL, s1.PROGRAM,s1.ACTION,s1.MODULE
      6      from v$lock l1, v$session s1, v$lock l2, v$session s2
      7      where s1.sid=l1.sid and s2.sid=l2.sid
      8      and l1.BLOCK=1 and l2.request > 0
      9      and l1.id1 = l2.id1
    10      and l2.id2 = l2.id2
    11      and l1.ctime >0;
    12  begin
    13  for i in c1 loop
    14  EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || i.sid || ',' || i.serial# || '''';
    15  stmt := 'insert into killsessionlog values ('||i.killtime||','|| i.username||','||i.sid||','||i
    .serial#||','||i.ctime||','||i.machine||','||i.TERMINAL||','|| i.PROGRAM||','||i.ACTION||','||i.MODU
    LE||')'
    16  ;
    17  EXECUTE IMMEDIATE stmt;
    18  dbms_output.put_line('SID '||i.sid ||' with serial# '||i.serial#||' was killed');
    19    END LOOP;
    20  END;
    21  /
    Procedure created.created the blocker and blocked sessions.
    SQL> exec killblocker
    BEGIN killblocker; END;
    ERROR at line 1:
    ORA-00936: missing expression
    ORA-06512: at "NN.KILLBLOCKER", line 17
    ORA-06512: at line 1the first EXECUTE IMMEDIATE for killing the session worked, but the 2nd EXECUTE IMMEDIATE for the insert failed as above. Not able to figure the problem.
    TIA

    SQL> create or replace procedure killblocker
      2  is
      3  stmt varchar2(1000);
      4  cursor c1 is
      5  select  s1.SQL_EXEC_START+l1.ctime killtime, s1.username,s1.sid,s1.serial#,l1.ctime ,s1.machine
    ,s1.TERMINAL, s1.PROGRAM,s1.ACTION,s1.MODULE
      6      from v$lock l1, v$session s1, v$lock l2, v$session s2
      7      where s1.sid=l1.sid and s2.sid=l2.sid
      8      and l1.BLOCK=1 and l2.request > 0
      9      and l1.id1 = l2.id1
    10      and l2.id2 = l2.id2
    11      and l1.ctime >0;
    12  begin
    13  for i in c1 loop
    14  EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || i.sid || ',' || i.serial# || '''';
    15  stmt := 'insert into killsessionlog values (:killtime, :username, :sid, :serial#, :ctime, :machine, :TERMINAL, :PROGRAM, :ACTION, :MODULE)'
    16  ;
    17  EXECUTE IMMEDIATE stmt using i.killtime, i.username, i.sid, i.serial#, i.ctime, i.machine, i.TERMINAL, i.PROGRAM, i.ACTION, i.MODULE;
    18  dbms_output.put_line('SID '||i.sid ||' with serial# '||i.serial#||' was killed');
    19    END LOOP;
    20  END;
    21  / Gerard

  • ORA-00936: Missing Expression? please help

    i just created the following function. I am passing the parameter, which is a varchar2 datatype. The result i am trying to get from this function is also a varchar2, which makes sense since the table is a table that only has varchar2 datatypes. . .so i guess i need to convert the result to a number. How do i do this? I don't quite know the syntax.
    when i try and run what i have i get the following error:
    ORA-00936: missing expression
    ORA-06512: at "SMSRPT.GET_NUMBER", line 8
    ORA-06512: at line 7
    create or replace FUNCTION get_number(p_name VARCHAR2) return NUMBER as
    --DECLARE
    v_value varchar2(100);
    v_result varchar2(100);
         BEGIN
              v_value:='select value from config_params where name='||p_name;
              execute immediate v_value into v_result;
    return v_result;
    END;

    How about this (updating polasa's response)
    CREATE OR REPLACE FUNCTION new_number(p_name VARCHAR2) RETURN NUMBER AS
    v_value VARCHAR2(1000);
    v_result NUMBER;
    BEGIN
    v_value :=('select value from config_param where name = :1');
    EXECUTE IMMEDIATE v_value
    INTO v_result USING p_name;
    RETURN v_result;
    END new_number;or this
    CREATE OR REPLACE FUNCTION get_number(p_name VARCHAR2) RETURN NUMBER AS
       v_value VARCHAR2(1000);
       v_result NUMBER;
       TYPE rct_cursor IS REF CURSOR; --REF CURSOR for dynamic Cursors.
       d_sql        rct_cursor;
    BEGIN
      v_value := 'select value from config_param where name = :1';
      OPEN d_sql
      FOR v_value
        USING p_name;
      FETCH d_sql INTO v_result;
      IF d_sql%NOTFOUND THEN
         v_result := NULL;
      END IF;
      CLOSE d_sql;
      RETURN v_result;
    END get_number; so the answer is "yes it can be done in dynamic SQL". The question is why do you want to given the advantages of static SQL over dynamic SQL?

  • EDQ - error exporting to DB: ORA-00928 missing SELECT

    Hi,
    I am using EDQ v12.1.3.0.0 and have created a very basic proof of concept process which takes as input a comma-demilited file through the Reader process and then has a Write processor to write the input to Staged Data.
    I am then trying to Export the staged data to the relevant table in the database but get the following error message:
    'xxxxxx failed: Problem writing insert batch to database: ORA-00928: missing SELECT keyword.
    The input file/staged data only contains a single comma-delimited file with 3 fields and on the other side in the database, all I have in the schema is a single table which I am writing to. I can connect to my target DB datastore in EDQ without any problems.
    Does anyone have any ideas as to what could be causing this? Reading up on this error suggests that it is to with the SELECT keyword missing from a CREATE VIEW statement but I am not sure where or why it is trying to create a view.
    Any help would be much appreciated.

    Hi Mike,
    Many thanks for your quick response.
    I am writing to an existing table and wasn't seeing the three options which you've suggested, and which I've seen also appear in the documentation. But based on what you've said above, I now understand that I won't see those options because I am running a standalone export by right-clicking in the tree, rather than in a job.
    The target table didn't have a PK defined and I have since added one and ran the stand-alone export again and it has worked this time - Thanks. Thanks also for pointing out that the export will be DELETING and INSERTING - I was wondering why each time the export was failing it was removing records from the table, as I thought in this mode it would just be doing a straightforward INSERT. (So it was doing the DELETE part ok but failing on the INSERT).
    I would also like to know another couple of things please.
    1) How can I add this Export to a newly created Job? I have created a Job and put my Process in there, but when I try and drag-and-drop the Export, I get a no-entry sign indicating that I'm not allowed to do this. My target datastore is server-based rather than client-based and I thought that this should be ok if doing an export.
    2) Is it possible to call database stored procedures on the target database and then let that take care of inserts? E.g. rather than letting EDQ insert the records straight into the target DB, would like to make a call to a PL/SQL stored procedure which takes the data to be inserted as input (if at all possible, I understand this could be difficult if dealing with multiple records, unless the procedure can be called each time for each record), and then performs some checks before inserting the records.
    EDIT: regarding point 2 above, I have just come across this - How to call Oracle Stored Procedure using EDQ.

  • Trying to use authorization schema but getting ORA-00907: missing right par

    Hi,
    I am fairly new to HMTLDB. I am busy going through the Issue Tracker Tutorial. I am on the last part of Tutorial. This part involves authorizing a user based on their roles in the company.
    I now keep getting the following when I load my pages
    ORA-00907: missing right parenthesis
    Error ERR-1082 Error in executing authorization scheme code.
    How do I go about debugging this error not sure where to start?

    if this helps I am using this PDF
    http://www.oracle.com/technology/products/database/application_express/pdf/issue_tracking_tutorial_1.6_0.pdf
    if you open the PDF file I am stuck on page 72-74. The page I am trying to open while i am logged on as FUNKYMONKEY is Page 4 which is in the documentation

  • ORA-00907: missing right parenthesi

    hello,
    hi, i am having a problem with creating a temporary table
    create global temporary table tt_My0
    id NUMBER(10,5) DEFAULT NULL,
    NAME VARCHAR2(40) DEFAULT NULL,
    )but its giving an error
    ORA-00907: missing right parenthesisi guess, its giving me that error cause it is considering field-name NAME as a keyword..
    so how can i cop up that error
    thank you..

    it worked here ,i jusr removed a comma.
       create global temporary table tt_My0
    id NUMBER(10,5) DEFAULT NULL,
    NAME VARCHAR2(40) DEFAULT NULL            -----removed comma
    )Hope it helps,
    CKLP
    Edited by: CKLP on Apr 5, 2011 10:26 PM

  • PL/SQL ORA-00936 missing expression

    Hello all,
    I'm having an issues and need help with this script... Please help, thanks.
    error:
    ====
    31 32 /
    AST_UPDATED_BY,LAST_UPDATE_LOGIN) values(i,'ERROR_LOG_ID'||i, 'PROCEDURE_NAME'||i||, 'REQUEST_ID' |i||, 'PROCESS_NAME' ||i||, 'ERROR_TYPE'|i|, 'MESSAGE_DETAILS' ||i||, 'ERROR_TIMESTAMP' |i|, 'STATUS' ||i||, 'CREATED_BY' ||i||, 'CREATION_DATE' ||i||, "to_char(last_update_date, 'dd-Mon-yyyy hh:mi:ss')" |i|, 'LAST_UPDATED_BY' ||i||, 'LAST_UPDATE_LOGIN');
    ERROR at line 28:
    ORA-06550: line 28, column 84:
    PL/SQL: ORA-00936: missing expression
    ORA-06550: line 27, column 1:
    PL/SQL: SQL Statement ignored
    script.
    ====
    declare
    CURSOR c_iostats IS
    SELECT * from XXFRO.XXFRO_ERRORS;
    ERROR_LOG_ID NUMBER;
    PROCESS_NAME VARCHAR2(50);
    ERROR_TYPE VARCHAR2(20);
    STATUS VARCHAR2(20);
    MESSAGE_DETAILS VARCHAR2(2000);
    ERROR_LOG_ID NUMBER;
    PROCEDURE_NAME VARCHAR2(50);
    REQUEST_ID NUMBER;
    PROCESS_NAME VARCHAR2(50);
    ERROR_TYPE VARCHAR2(20);
    MESSAGE_DETAILS VARCHAR2(2000);
    ERROR_TIMESTAMP DATE;
    STATUS VARCHAR2(20);
    CREATED_BY NUMBER;
    CREATION_DATE DATE;
    LAST_UPDATE_DATE DATE;
    LAST_UPDATED_BY NUMBER;
    LAST_UPDATE_LOGIN NUMBER;
    Begin
    for i in 1..1000000 LOOP
    insert into IO_TEST(ERROR_LOG_ID
    ,PROCEDURE_NAME
    ,REQUEST_ID
    ,PROCESS_NAME
    ,ERROR_TYPE
    ,MESSAGE_DETAILS
    ,ERROR_TIMESTAMP
    ,STATUS,CREATED_BY
    ,CREATION_DATE
    ,LAST_UPDATE_DATE
    ,LAST_UPDATED_BY
    ,LAST_UPDATE_LOGIN)
    values(i,'ERROR_LOG_ID'||i, 'PROCEDURE_NAME'||i||, 'REQUEST_ID' |i||, 'PROCESS_NAME' ||i||, 'ERROR_TYPE'|i|, 'MESSAGE_DETAILS' ||i||, 'ERROR_TIMESTAMP' |i|, 'STATUS' ||i||, 'CREATED_BY' ||i||, 'CREATION_DATE' ||i||,'LAST_UPDATE_DATE' ||i||, 'LAST_UPDATED_BY' ||i||, 'LAST_UPDATE_LOGIN');
    END LOOP;
    end;
    Thanks,
    HCDBA

    Hi,
    Why are you using the concat(||) Symbol after i in the expression String 'CREATED_BY' ||i||. When you are padding between
    two text we use so.
    Ex: If you want to concat 'i' between String we use
    DBMS_OUTPUT.PUT_LINE('Five is between '|| i || 'and Six');The Insert Statement should be re-written as
    INSERT INTO io_test
                (error_log_id, procedure_name, request_id,
                 process_name, ERROR_TYPE, message_details,
                 error_timestamp, status, created_by,
                 creation_date, last_update_date,
                 last_updated_by, last_update_login
         VALUES (i, 'ERROR_LOG_ID' || i, 'PROCEDURE_NAME' || i,
                  'REQUEST_ID' || i, 'PROCESS_NAME' || i, 'ERROR_TYPE' || i,
                  'MESSAGE_DETAILS'
                  || i, 'ERROR_TIMESTAMP' || i, 'STATUS' || i,
                  'CREATED_BY' || i, 'CREATION_DATE' || i,
                  'LAST_UPDATE_DATE' || i, 'LAST_UPDATED_BY' || i,
                 'LAST_UPDATE_LOGIN'
                );Thanks,
    Shankar

  • IR Report Search - ORA-20001: get_dbms_sql_cursor error ORA-00936: missing expression

    Hi All,
      I had created a IR report based on a table and it was working with no issues.  But after few days, when I try searching using the IR search bar it shows "ORA-20001: get_dbms_sql_cursor error ORA-00936: missing expression" error message. I don't see any debug messages or errors in the debug window. The Finder drop down is empty too, there are no columns displayed to filter.
    When I recreate the IR report(new page) based on the same table, It works fine and there are no issues with the search.  But the old IR report search doesnt work. I have not modified the any thing in the old report after initial creation. Report uses Primary key based on a sequence.
    What might have caused this issue?
    Is there a way to intercept the search query from IR report?
    Apex version - 4.2.3.00.08.
    Any help on this appreciated.
    Thanks,
    Jagan

    Hi MK, as I had mentioned in my post, I don't see any logs in the debug window, query tab.
    Can you please guide me how to check the query logs on search?
    Thanks,
    Jagan

  • ERROR: ORACLE prepare error: ORA-00936: missing expression

    Hello,
    I am required to run "pass-through" Oracle SQL, to extract data from tables into SAS for processing and manipulation. My code (attached) reads and writes (executes) but with zero records to test first. I cannot get past the Prepare Error.
    The query is very much like other queries that seem to work, but I cannot get past this prepare error. I have no other access to individauls with adequate knowledge of PL SQL, and as a last stop hoped others in the forum could quickly spot the source of errror.
    Thanks very much in advance for any assistance.
    Jeff
    1 ;*';*";*/;quit;run;
    2 OPTIONS PAGENO=MIN;
    3 %LET _CLIENTTASKLABEL=%NRBQUOTE(rx_biplr_v3_2);
    4 %LET _EGTASKLABEL=%NRBQUOTE(rx_biplr_v3_2);
    5 %LET _CLIENTPROJECTNAME=%NRBQUOTE();
    6 %LET _SASPROGRAMFILE=;
    7
    8 ODS _ALL_ CLOSE;
    NOTE: Some of your options or statements may not be supported with the Activex or Java series of devices. Graph defaults for these
    drivers may be different from other SAS/GRAPH device drivers. For further information, please contact Technical Support.
    9 OPTIONS DEV=ACTIVEX;
    10 FILENAME EGHTML TEMP;
    NOTE: Writing HTML(EGHTML) Body file: EGHTML
    11 ODS HTML(ID=EGHTML) FILE=EGHTML ENCODING='utf-8' STYLE=EGDefault
    11 ! STYLESHEET=(URL="file:///C:/Program%20Files/SAS/Shared%20Files/BIClientStyles/EGDefault.css")
    11 ! ATTRIBUTES=("CODEBASE"="http://www2.sas.com/codebase/graph/v91/sasgraph.exe") NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation
    11 ! ;
    12
    13 %gaccessible;
    14 /********************************************************/
    15 * RX_BIPLR_V3.SAS ;
    16 /********************************************************/
    17
    18 dm 'log;clear;out;clear';
    19 options linesize =120;
    20 Option obs=0 NoReplace;
    21
    22 ****************************************************************************************;
    23 *Date Programmer Reviewed By WHAT WAS DONE;
    24 *----- -------------- ------------ -----------------------------------------;
    25 *2005 David Boyd Program creation for test population;
    26 *;
    27 *02/06/2006 Ivon Jones Modified to include total population;
    28 *;
    29 *07/20/2006 Ivon Jones Identified data elements for exclusion;
    30 * or inclusion for consolidation with ;
    31 * Robin's report;
    32 *;
    33 *08/18/2006 Ivon Jones Updated the Specific Therapeutic Classes;
    34 * 10-2009 J Shaf - modified to extract actual or potential Bipolar Dx from UBH and Medical Claims;
    35 ****************************************************************************************;
    36
    37
    38
    39 *%let allclmorgn = ('M','A') ; /* all claims origin code */
    40 %let begdate='01SEP2009'd;
    41 %let enddate='30SEP2009'd;
    42 %let q = %str(%') ;
    43
    44
    45 data _null_ ;
    46 call symput('fdos',put(intnx('month',"&begdate"d,-27,'beginning'), date9.) ) ;
    47 call symput('ldos',put(intnx('month',"&enddate"d,-0,'ending'), date9.) ) ;
    48 run ;
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    2 The SAS System 11:44 Friday, October 30, 2009
    cpu time 0.01 seconds
    49
    50
    51
    52 **************************************************************;
    53 * ??Use the data _null_ step to create a macro variable for the ;
    54 * year and month based on the ldos macro variable in the data ;
    55 * step above?? ;
    56 **************************************************************;
    57
    58
    59 data _null_ ;
    60 if month("&ldos"d) < 10
    61 then call symput('yr_mo',compress(year("&ldos"d) || '0' || month("&ldos"d) ) ) ;
    62 else call symput('yr_mo',compress(year("&ldos"d) || month("&ldos"d) ) ) ;
    63 run ;
    NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
    61:39 61:64 62:39 62:57
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    cpu time 0.00 seconds
    64
    65 *%put &biplr_dx;
    66 %put &begdate ;
    '01SEP2009'd
    67 %put &enddate ;
    '30SEP2009'd
    68 %put &fdos ;
    01JUN2007
    69 %put &ldos ;
    30SEP2009
    70 %put &q ;
    71
    72
    73 libname biplr'/home/jshafi01/projects/adhoc/biplr_dprsn/data';
    NOTE: Libref BIPLR was successfully assigned as follows:
    Engine: V9
    Physical Name: /home/jshafi01/projects/adhoc/biplr_dprsn/data
    74 libname rosdwp oracle user="&oracle_user." pass="&oracle_pass." buffsize=32767 path='rosdwp';
    NOTE: Libref ROSDWP was successfully assigned as follows:
    Engine: ORACLE
    Physical Name: rosdwp
    75
    76 data work.biplr_up_v1;
    77 attrib mbr_id length=$26;
    78 set biplr.biplr_ubh_med_v1;
    79 run;
    NOTE: There were 0 observations read from the data set BIPLR.BIPLR_UBH_MED_V1.
    NOTE: The data set WORK.BIPLR_UP_V1 has 0 observations and 1 variables.
    NOTE: DATA statement used (Total process time):
    real time 0.01 seconds
    3 The SAS System 11:44 Friday, October 30, 2009
    cpu time 0.00 seconds
    80
    81 proc contents;
    82 run;
    NOTE: PROCEDURE CONTENTS used (Total process time):
    real time 0.03 seconds
    cpu time 0.03 seconds
    83
    84 proc datasets
    85      library = rosdwp nolist;
    86      delete biplr_up_v1;
    87 quit;
    NOTE: Deleting ROSDWP.BIPLR_UP_V1 (memtype=DATA).
    NOTE: PROCEDURE DATASETS used (Total process time):
    real time 3.74 seconds
    cpu time 0.03 seconds
    88
    89 proc datasets
    90      library=work nolist;
    91      copy out = rosdwp move;
    92      select biplr_up_v1 ;
    93 quit;
    NOTE: Moving WORK.BIPLR_UP_V1 to ROSDWP.BIPLR_UP_V1 (memtype=DATA).
    NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.
    NOTE: There were 0 observations read from the data set WORK.BIPLR_UP_V1.
    NOTE: The data set ROSDWP.BIPLR_UP_V1 has 0 observations and 1 variables.
    NOTE: PROCEDURE DATASETS used (Total process time):
    real time 0.32 seconds
    cpu time 0.04 seconds
    94
    95
    96
    97 *****************************************************************************;
    98
    99 *execute(commit) by rosdwp
    100 ******************************************************************************;
    101
    102
    103 proc SQL noprint ;
    104 connect to oracle as rosdwp (user="&oracle_user." password="&oracle_pass" buffsize=32767 path='rosdwp'
    104 ! preserve_comments);
    105      execute(alter session set nls_date_format = 'ddmonyyyy') by rosdwp;
    106 CREATE table biplr_rx as
    107 SELECT
    108 mrb_id,
    109 pcp_spc,
    110 rx_date,
    4 The SAS System 11:44 Friday, October 30, 2009
    111 brand,
    112 generic,
    113 ahfs_cd,
    114 ahfs_dsc,
    115 lbl,
    116 strngth,
    117 unt,
    118 spc_tx_cls_cd,
    119 spc_tx_cls_dsc,
    120 gcn,
    121 rx_num,
    122 rx_ingrd,
    123 rx_paid,
    124 rx_cnt,
    125 rx_qty,
    126 rx_day
    127 FROM connection to rosdwp
    128 (SELECT
    129 mid.UNIQ_MBR_ID as mrb_id,
    130 pd.PRVDR_SPCLTY_DESC as pcp_spc,
    131 pcf.LAST_SRVC_DT as rx_date,
    132 dd.BRAND_NAME as brand,
    133 dd.GNRC_NAME as generic,
    134 dd.AHFS_THRPTC_CLS_CD as ahfs_cd,
    135 dd.AHFS_THRPTC_CLS_DESC as ahfs_dsc,
    136 dd.LABEL_NAME as lbl,
    137 dd.STRNGTH_NUM as strngth,
    138 dd.STRNGTH_UNIT_DESC as unt,
    139 dd.SPECF_THRPTC_CLS_CD as spc_tx_cls_cd,
    140 dd.SPECF_THRPTC_CLS_DESC as spc_tx_cls_dsc,
    141 dd.GCN_NUM as gcn,
    142 pcf.PRSCRPTN_NUM as rx_num,
    143 SUM(pcf.INGRDNT_AMT) as rx_ingrd,
    144 SUM(pcf.PD_AMT) as rx_paid,
    145 SUM(pcf.UNIT_SRVC_CNT) as rx_cnt,
    146 SUM(pcf.DSPNSD_QTY) as rx_qty,
    147 SUM(pcf.DAY_SUPLY_CNT) as rx_day
    148 FROM
    149 PHRMCY_CLM_FACT pcf,
    150 MBR_ID_DMNSN mid,
    151 DRUG_DMNSN dd,
    152 PRVDR_DMNSN pd,
    153           biplr_up_v1
    154 WHERE
    155 (
    156 (biplr_up_v1.mbr_id = MBR_ID_DMNSN.UNIQ_MBR_ID) And
    157 (PHRMCY_CLM_FACT.FINL_CLM_KEY = PHRMCY_FINL_CLM_DMNSN.FINL_CLM_KEY) AND
    158 (PHRMCY_CLM_FACT.MBR_KEY = MBR_ID_DMNSN.MBR_KEY) And
    159 (PHRMCY_CLM_FACT.BNFT_KEY = MBR_BNFT_DMNSN.BNFT_KEY) And
    160 (PHRMCY_CLM_FACT.DRUG_KEY = DRUG_DMNSN.DRUG_KEY) And
    161 (PHRMCY_FINL_CLM_DMNSN.CLM_ORGN_CD IN ('M','A')) AND
    162 (PHRMCY_CLM_FACT.LAST_SRVC_DT BETWEEN between &q.&fdos.&q and &q.&ldos.&q)
    163      )
    164 Group By
    165 mid.UNIQ_MBR_ID ,
    166 pd.PRVDR_SPCLTY_DESC ,
    167 pcf.LAST_SRVC_DT ,
    168 dd.BRAND_NAME ,
    5 The SAS System 11:44 Friday, October 30, 2009
    169 dd.GNRC_NAME ,
    170 dd.AHFS_THRPTC_CLS_CD ,
    171 dd.AHFS_THRPTC_CLS_DESC ,
    172 dd.LABEL_NAME ,
    173 dd.STRNGTH_NUM ,
    174 dd.STRNGTH_UNIT_DESC ,
    175 dd.SPECF_THRPTC_CLS_CD ,
    176 dd.SPECF_THRPTC_CLS_DESC ,
    177 dd.GCN_NUM ,
    178 pcf.PRSCRPTN_NUM
    179 );
    ERROR: ORACLE prepare error: ORA-00936: missing expression. SQL statement: SELECT mid.UNIQ_MBR_ID as mrb_id,
    pd.PRVDR_SPCLTY_DESC as pcp_spc, pcf.LAST_SRVC_DT as rx_date, dd.BRAND_NAME as brand, dd.GNRC_NAME as generic,
    dd.AHFS_THRPTC_CLS_CD as ahfs_cd, dd.AHFS_THRPTC_CLS_DESC as ahfs_dsc, dd.LABEL_NAME as lbl, dd.STRNGTH_NUM as
    strngth, dd.STRNGTH_UNIT_DESC as unt, dd.SPECF_THRPTC_CLS_CD as spc_tx_cls_cd, dd.SPECF_THRPTC_CLS_DESC as
    spc_tx_cls_dsc, dd.GCN_NUM as gcn, pcf.PRSCRPTN_NUM as rx_num, SUM(pcf.INGRDNT_AMT) as rx_ingrd, SUM(pcf.PD_AMT)
    as rx_paid, SUM(pcf.UNIT_SRVC_CNT) as rx_cnt, SUM(pcf.DSPNSD_QTY) as rx_qty, SUM(pcf.DAY_SUPLY_CNT) as rx_day
    FROM PHRMCY_CLM_FACT pcf, MBR_ID_DMNSN mid, DRUG_DMNSN dd, PRVDR_DMNSN pd, biplr_up_v1 WHERE (
    (biplr_up_v1.mbr_id = MBR_ID_DMNSN.UNIQ_MBR_ID) And (PHRMCY_CLM_FACT.FINL_CLM_KEY =
    PHRMCY_FINL_CLM_DMNSN.FINL_CLM_KEY) AND (PHRMCY_CLM_FACT.MBR_KEY = MBR_ID_DMNSN.MBR_KEY) And
    (PHRMCY_CLM_FACT.BNFT_KEY = MBR_BNFT_DMNSN.BNFT_KEY) And (PHRMCY_CLM_FACT.DRUG_KEY = DRUG_DMNSN.DRUG_KEY) And
    (PHRMCY_FINL_CLM_DMNSN.CLM_ORGN_CD IN ('M','A')) AND (PHRMCY_CLM_FACT.LAST_SRVC_DT BETWEEN between '01JUN2007'
    and '30SEP2009') ) Group By mid.UNIQ_MBR_ID , pd.PRVDR_SPCLTY_DESC , pcf.LAST_SRVC_DT , dd.BRAND_NAME ,
    dd.GNRC_NAME , dd.AHFS_THRPTC_CLS_CD , dd.AHFS_THRPTC_CLS_DESC , dd.LABEL_NAME , dd.STRNGTH_NUM ,
    dd.STRNGTH_UNIT_DESC , dd.SPECF_THRPTC_CLS_CD , dd.SPECF_THRPTC_CLS_DESC , dd.GCN_NUM , pcf.PRSCRPTN_NUM.
    NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
    180 execute (drop table biplr_up_v1) by rosdwp;
    NOTE: Statement not executed due to NOEXEC option.
    181 disconnect from rosdwp;
    NOTE: Statement not executed due to NOEXEC option.
    182 quit;
    NOTE: The SAS System stopped processing this step because of errors.
    NOTE: PROCEDURE SQL used (Total process time):
    real time 0.14 seconds
    cpu time 0.03 seconds
    183
    184

    Hello Again ,
    Wish Oracle was a bit more informative. Am using a SAS Institute Product called Enterprise Guide. A "hot fix" was installed to address an issue that the product appears unable to save the latest version of edited code changes (hence " BETWEEN between" remaining even after a prior edit). In any case, with the change, am now receiving this error:
    " ERROR: ORACLE prepare error: ORA-00904: "PHRMCY_CLM_FACT"."LAST_SRVC_DT": invalid identifier". (Log file appears below)
    -The error remains, regardless of whether one uses "pass through" code to pass the date range to Oracle (which looks ok from the log output below I believe), or if I hard code the date range into the PL SQL query itself.
    -The Prepare error always appears at end of the inner SELECT.
    -The Prepare error remains, with or without the GROUP BY clause.
    Is there anything else here I am missing? Someone suggested a reserve word - but from other ANSI SQL versions, I do not see that is the case. I have consulted SAS Tech Support and SAS List Serve at University of GA. but nothing definitive from these sources. Have requested facility to be able to run Oracle directly, outside this SAS Institute product - in process.
    Any suggestions are greatly appreciated. Thanks to everyone very much.
    Jeff
    14 /********************************************************/
    15 * RX_BIPLR_V3.SAS ;
    16 /********************************************************/
    17
    18 dm 'log;clear;out;clear';
    19 options linesize =120;
    20 Option obs=0 NoReplace;
    21
    22 ****************************************************************************************;
    23 *Date       Programmer         Reviewed By     WHAT WAS DONE;
    24 *-----      --------------     ------------    -----------------------------------------;
    25 *2005 D. Boyd Program creation for test population;
    26 *;
    27 *02/06/2006 I. Jones Modified to include total population;
    28 *;
    29 *07/20/2006 I. Jones Identified data elements for exclusion;
    30 * or inclusion for consolidation with ;
    31 * Robin's report;
    32 *;
    33 *08/18/2006 I Jones Updated the Specific Therapeutic Classes;
    34 * 10-2009 J Shaf - modified to extract actual or potential Bipolar Dx from UBH and Medical Claims;
    35 ****************************************************************************************;
    36
    37
    38
    39 *%let allclmorgn = ('M','A') ; /* all claims origin code */
    40 %let begdate='01SEP2009'd;
    41 %let enddate='30SEP2009'd;
    42 %let q = %str(%') ;
    43
    44
    45 data null ;
    46 call symput('fdos',put(intnx('month',"&begdate"d,-27,'beginning'), date9.) ) ;
    47 call symput('ldos',put(intnx('month',"&enddate"d,-0,'ending'), date9.) ) ;
    48 run ;
    2 The SAS System 12:46 Monday, November 2, 2009
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    cpu time 0.00 seconds
    49
    50
    51
    52 **************************************************************;
    53 * ??Use the data null step to create a macro variable for the ;
    54 * year and month based on the ldos macro variable in the data ;
    55 * step above?? ;
    56 **************************************************************;
    57
    58
    59 data null ;
    60 if month("&ldos"d) < 10
    61 then call symput('yr_mo',compress(year("&ldos"d) || '0' || month("&ldos"d) ) ) ;
    62 else call symput('yr_mo',compress(year("&ldos"d) || month("&ldos"d) ) ) ;
    63 run ;
    NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
    61:39 61:64 62:39 62:57
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    cpu time 0.01 seconds
    64
    65 *%put &biplr_dx;
    66 %put &begdate ;
    '01SEP2009'd
    67 %put &enddate ;
    '30SEP2009'd
    68 %put &fdos ;
    01JUN2007
    69 %put &ldos ;
    30SEP2009
    70 %put &q ;
    71
    72
    73 libname biplr'/home/jshafi01/projects/adhoc/biplr_dprsn/data';
    NOTE: Libref BIPLR was successfully assigned as follows:
    Engine: V9
    Physical Name: /home/jshafi01/projects/adhoc/biplr_dprsn/data
    74 libname rosdwp oracle user="&oracle_user." pass="&oracle_pass." buffsize=32767 path='rosdwp';
    NOTE: Libref ROSDWP was successfully assigned as follows:
    Engine: ORACLE
    Physical Name: rosdwp
    75
    76 data work.biplr_up_v1;
    77 attrib mbr_id length=$26;
    78 set biplr.biplr_ubh_med_v1;
    79 run;
    NOTE: There were 0 observations read from the data set BIPLR.BIPLR_UBH_MED_V1.
    NOTE: The data set WORK.BIPLR_UP_V1 has 0 observations and 1 variables.
    NOTE: DATA statement used (Total process time):
    real time 0.00 seconds
    cpu time 0.01 seconds
    80
    81 proc contents;
    82 run;
    NOTE: PROCEDURE CONTENTS used (Total process time):
    real time 0.02 seconds
    cpu time 0.02 seconds
    83
    84 proc datasets
    85      library = rosdwp nolist;
    86      delete biplr_up_v1;
    87 quit;
    NOTE: Deleting ROSDWP.BIPLR_UP_V1 (memtype=DATA).
    NOTE: PROCEDURE DATASETS used (Total process time):
    real time 0.61 seconds
    cpu time 0.01 seconds
    88
    89 proc datasets
    90      library=work nolist;
    91      copy out = rosdwp move;
    92      select biplr_up_v1 ;
    93 quit;
    NOTE: Moving WORK.BIPLR_UP_V1 to ROSDWP.BIPLR_UP_V1 (memtype=DATA).
    NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.
    NOTE: There were 0 observations read from the data set WORK.BIPLR_UP_V1.
    NOTE: The data set ROSDWP.BIPLR_UP_V1 has 0 observations and 1 variables.
    NOTE: PROCEDURE DATASETS used (Total process time):
    real time 0.15 seconds
    cpu time 0.04 seconds
    94
    95
    96
    97 *****************************************************************************;
    98
    99 *execute(commit) by rosdwp
    100 ******************************************************************************;
    101
    102
    103 proc SQL noprint ;
    104 connect to oracle as rosdwp (user="&oracle_user." password="&oracle_pass" buffsize=32767 path='rosdwp'
    104 ! preserve_comments);
    105      execute(alter session set nls_date_format = 'ddmonyyyy') by rosdwp;
    106 CREATE table biplr_rx as
    107 SELECT
    108 mrb_id,
    109 uniq_mbr_id,
    110 pcp_spc,
    111 rx_date,
    112 brand,
    113 generic,
    114 ahfs_cd,
    115 ahfs_dsc,
    116 lbl,
    117 strngth,
    118 unt,
    119 spc_tx_cls_cd,
    120 spc_tx_cls_dsc,
    121 gcn,
    122 rx_num,
    123 rx_ingrd,
    124 rx_paid,
    125 rx_cnt,
    126 rx_qty,
    127 rx_day
    128 FROM connection to rosdwp
    129 (SELECT
    130 mid.UNIQ_MBR_ID as uniq_mrb_id,
    131 blpr.mrb_id.mbr_id,
    132 pd.PRVDR_SPCLTY_DESC as pcp_spc,
    133 pcf.LAST_SRVC_DT as rx_date,
    134 dd.BRAND_NAME as brand,
    135 dd.GNRC_NAME as generic,
    136 dd.AHFS_THRPTC_CLS_CD as ahfs_cd,
    137 dd.AHFS_THRPTC_CLS_DESC as ahfs_dsc,
    138 dd.LABEL_NAME as lbl,
    139 dd.STRNGTH_NUM as strngth,
    140 dd.STRNGTH_UNIT_DESC as unt,
    141 dd.SPECF_THRPTC_CLS_CD as spc_tx_cls_cd,
    142 dd.SPECF_THRPTC_CLS_DESC as spc_tx_cls_dsc,
    143 dd.GCN_NUM as gcn,
    144 pcf.PRSCRPTN_NUM as rx_num,
    145 SUM(pcf.INGRDNT_AMT) as rx_ingrd,
    146 SUM(pcf.PD_AMT) as rx_paid,
    147 SUM(pcf.UNIT_SRVC_CNT) as rx_cnt,
    148 SUM(pcf.DSPNSD_QTY) as rx_qty,
    149 SUM(pcf.DAY_SUPLY_CNT) as rx_day
    150 FROM
    151 PHRMCY_CLM_FACT pcf,
    152 MBR_ID_DMNSN mid,
    153 DRUG_DMNSN dd,
    154 PRVDR_DMNSN pd,
    155      BIPLR_UP_V1 blpr
    156 WHERE
    157 (BIPLR_UP_V1.mbr_id = MBR_ID_DMNSN.UNIQ_MBR_ID) And
    158 (PHRMCY_CLM_FACT.FINL_CLM_KEY = PHRMCY_FINL_CLM_DMNSN.FINL_CLM_KEY) AND
    159 (PHRMCY_CLM_FACT.MBR_KEY = MBR_ID_DMNSN.MBR_KEY) And
    160 (PHRMCY_CLM_FACT.BNFT_KEY = MBR_BNFT_DMNSN.BNFT_KEY) And
    161 (PHRMCY_CLM_FACT.DRUG_KEY = DRUG_DMNSN.DRUG_KEY) And
    162 (PHRMCY_FINL_CLM_DMNSN.CLM_ORGN_CD IN ('M','A')) AND
    163 (PHRMCY_CLM_FACT.LAST_SRVC_DT BETWEEN &q.&fdos.&q and &q.&ldos.&q)
    164 );
    ERROR: ORACLE prepare error: ORA-00904: "PHRMCY_CLM_FACT"."LAST_SRVC_DT": invalid identifier. SQL statement: SELECT
    mid.UNIQ_MBR_ID as uniq_mrb_id, blpr.mrb_id.mbr_id, pd.PRVDR_SPCLTY_DESC as pcp_spc, pcf.LAST_SRVC_DT as
    rx_date, dd.BRAND_NAME as brand, dd.GNRC_NAME as generic, dd.AHFS_THRPTC_CLS_CD as ahfs_cd,
    dd.AHFS_THRPTC_CLS_DESC as ahfs_dsc, dd.LABEL_NAME as lbl, dd.STRNGTH_NUM as strngth, dd.STRNGTH_UNIT_DESC as
    unt, dd.SPECF_THRPTC_CLS_CD as spc_tx_cls_cd, dd.SPECF_THRPTC_CLS_DESC as spc_tx_cls_dsc, dd.GCN_NUM as gcn,
    pcf.PRSCRPTN_NUM as rx_num, SUM(pcf.INGRDNT_AMT) as rx_ingrd, SUM(pcf.PD_AMT) as rx_paid, SUM(pcf.UNIT_SRVC_CNT)
    as rx_cnt, SUM(pcf.DSPNSD_QTY) as rx_qty, SUM(pcf.DAY_SUPLY_CNT) as rx_day FROM PHRMCY_CLM_FACT pcf,
    MBR_ID_DMNSN mid, DRUG_DMNSN dd, PRVDR_DMNSN pd, BIPLR_UP_V1 blpr WHERE (BIPLR_UP_V1.mbr_id =
    MBR_ID_DMNSN.UNIQ_MBR_ID) And (PHRMCY_CLM_FACT.FINL_CLM_KEY = PHRMCY_FINL_CLM_DMNSN.FINL_CLM_KEY) AND
    (PHRMCY_CLM_FACT.MBR_KEY = MBR_ID_DMNSN.MBR_KEY) And (PHRMCY_CLM_FACT.BNFT_KEY = MBR_BNFT_DMNSN.BNFT_KEY) And
    (PHRMCY_CLM_FACT.DRUG_KEY = DRUG_DMNSN.DRUG_KEY) And (PHRMCY_FINL_CLM_DMNSN.CLM_ORGN_CD IN ('M','A')) AND
    (PHRMCY_CLM_FACT.LAST_SRVC_DT BETWEEN '01JUN2007' and '30SEP2009').
    NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
    165 execute (drop table biplr_up_v1) by rosdwp;
    NOTE: Statement not executed due to NOEXEC option.
    166 disconnect from rosdwp;
    NOTE: Statement not executed due to NOEXEC option.
    167 quit;
    NOTE: The SAS System stopped processing this step because of errors.
    NOTE: PROCEDURE SQL used (Total process time):
    real time 0.24 seconds
    cpu time 0.02 seconds
    168
    Edited by: user12142482 on Nov 2, 2009 4:02 PM

Maybe you are looking for

  • My computer no longer recognizes my Model M9244LL ipod. how can i fix this?

    itunes managed to erase all the music on the ipod when I connected it, and would not continue after that. The ipod said do not disconnect, then the music i did have on it was all erased.  After that the ipod reset and now the battery dies every time

  • Excel Query...

    I am using MS Query to pull data from an Oracle database. I am able to pull the data into MS Query by opening the query 'oracle.dqy' but when I return the data to Excel I get the error messages below: [Oracle][ODBC][Ora]ORA-12154: TNS:could not resol

  • My 3G ipod lost it's internet ability

    My 3G ipod was connected to a desk top and had an issue that made me reboot my computer. After rebooting the computer, I turned the ipod on, it said to log in and it froze claiming unauthorized user. I  brought the ipod to the original computer where

  • Tick marks?

    Can someone explain me the tick marks? So I have all kinds of playlists, and I have never manually used the tick marks, still some songs are without them? Why? Does it have anything to do with the fact that iPod got full and iTunes created this autom

  • Lync for Mac - How to customize profile image

    We are beginning to roll out Lync for Mac (and windows) and on the Mac side there doesn't seem to be a clear cut (easy) way to customize your icon like you can do in AIM, Yahoo Messenger, etc.  Knowing that I will get a bunch of calls regarding this,