What is wrong in this query?

Hi All,
Could anybody please help me in identifying the issue in the below code as i am getting error as:
declare
ERROR at line 1:
ORA-01006: bind variable does not exist
ORA-06512: at "SYS.DBMS_SYS_SQL", line 846
ORA-06512: at "SYS.DBMS_SQL", line 52
ORA-06512: at line 14
Below is my code :
declare
vSql varchar2(1000);
vSal number(10);
vName varchar2(20) := 'King';
hcur number;
lexe number;
Begin
hcur := dbms_sql.open_cursor;
vSql := 'select salary into :sal from employees where last_name = :name ';
dbms_sql.parse(hcur,vsql,dbms_sql.native);
dbms_sql.bind_variable(hcur,':name',vname);
dbms_sql.bind_variable(hcur,':sal',vSal,10);
lexe := dbms_sql.execute(hcur);
Loop
exit when dbms_sql.fetch_rows(hcur) = 0;
dbms_sql.variable_value(hcur,':sal',vSal);
end loop;
dbms_sql.close_cursor(hcur);
end;

Tandra:
Sorry, there were a couple of errors in my code. This should work (I actually tested this time)
DECLARE   vsql VARCHAR2(1000);
   vsal NUMBER(10);
   vname VARCHAR2(20) := 'King';
   hcur NUMBER;
   lexe NUMBER;
BEGIN
   hcur := DBMS_SQL.Open_Cursor;
   vsql := 'select salary from employees where last_name = :name ';
   DBMS_SQL.Parse(hcur,vsql,DBMS_SQL.Native);
   DBMS_SQL.Define_Column(hcur, 1, vsal);
   DBMS_SQL.Bind_Variable(hcur,':name',vname);
   lexe := DBMS_SQL.Execute(hcur);
   LOOP
      EXIT WHEN DBMS_SQL.Fetch_Rows(hcur) = 0;
      DBMS_SQL.Column_Value(hcur, 1, vSal);
   END LOOP;
   DBMS_SQL.Close_Cursor(hcur);
END; You need to define the columns in the SELECT list of the query and match them with a variable of the correct type (the call to DBMS_SQL.Define_Column). Note that the variable noes not need to be the same one that you will alter use to get the column value (the call to DBMS_SQL.Column_Value), not does it need to be of the same length as the actual column, only the same type. For VARCHAR2, CHAR and RAW columns you need to pass the length of the column as well. A slightly more complex version:
SQL> DECLARE   vsql VARCHAR2(1000);
  2     vsal NUMBER(10);
  3     vname VARCHAR2(20) := 'King';
  4     vfirst VARCHAR2(20);
  5     hcur NUMBER;
  6     lexe NUMBER;
  7     x NUMBER;
  8     y VARCHAR2(1);
  9  BEGIN
10     hcur := DBMS_SQL.Open_Cursor;
11     vsql := 'select first_name, salary from employees where last_name = :name ';
12     DBMS_SQL.Parse(hcur,vsql,DBMS_SQL.Native);
13     -- Note the dummy variables x and y in the call to Define_Column
14     DBMS_SQL.Define_Column(hcur, 1, y, 20);
15     DBMS_SQL.Define_Column(hcur, 2, x);
16     DBMS_SQL.Bind_Variable(hcur,':name',vname);
17     lexe := DBMS_SQL.Execute(hcur);
18     LOOP
19        EXIT WHEN DBMS_SQL.Fetch_Rows(hcur) = 0;
20        DBMS_SQL.Column_Value(hcur, 2, vSal);
21        DBMS_SQL.Column_Value(hcur, 1, vfirst);
22        DBMS_OUTPUT.Put_Line('First name: '||vfirst||' Salary: '||vsal);
23     END LOOP;
24     DBMS_SQL.Close_Cursor(hcur);
25  END;
26  /
First name: Janette Salary: 10000
First name: Steven Salary: 24000
PL/SQL procedure successfully completed.Now, I'm off to write "I will not post untested code" 100 times on the whiteboard.
HTH
John

Similar Messages

  • What is wrong with this query?

    Hi,
    The below query is showing this error:
    ORA-01788:CONNECT BY LOOP in user data.
    Please let me know where i am going wrong?
    The data in the table xx_dates is :
    Empno        date1                      date2
    1           20-JAN-2008            24-JAN-2008
    2           20-JAN-2008            20-JAN-2008The query i am using is:
    select empno,date1,date2,date1+level-1,level,DBMS_RANDOM.random
    from xx_dates
    connect by empno=prior empno  start with empno=1
               and date1 <= date2-level + 1Edited by: Sreekanth Munagala on Nov 17, 2008 6:01 AM

    Or maybe it's this you are looking for...
    SQL> ed
    Wrote file afiedt.buf
      1  with xx_dates as (select 1 as empno, to_date('20-JAN-2008','DD-MON-YYYY') as date1, to_date('24-JAN-2008','DD-MON-YYYY') as date2 from dual union all
      2                    select 2, to_date('20-JAN-2008','DD-MON-YYYY'), to_date('20-JAN-2008','DD-MON-YYYY') from dual)
      3  --
      4  select empno,date1,date2,date1+level-1,level,DBMS_RANDOM.random
      5  from xx_dates
      6  connect by level <= (date2-date1) + 1
      7* start with empno=1
    SQL> /
         EMPNO DATE1                DATE2                DATE1+LEVEL-1             LEVEL     RANDOM
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 20-JAN-2008 00:00:00          1 -291581367
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 21-JAN-2008 00:00:00          2 1347815622
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 22-JAN-2008 00:00:00          3 -595509310
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 23-JAN-2008 00:00:00          4 -1.602E+09
             1 20-JAN-2008 00:00:00 24-JAN-2008 00:00:00 24-JAN-2008 00:00:00          5 -1.511E+09
    SQL>

  • What's wrong with this query ?

    v_SQL := 'OPEN RCT' || v_iLevel || ' FOR
                   SELECT     datasets.*,
                        CASE fn_GetSupplierStatus(:p_SupplierID, DatasetID)
                             WHEN 1 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 1)
                             WHEN 3 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 2)
                             WHEN 4 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 3)
                             WHEN 5 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 4)
                             ELSE
                                  CASE IsDataset
                                       WHEN 0 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 5)
                                       ELSE SMfn_GetSpecifiedRow(:p_SupplierStatus, 5)
                                  END
                             END AS CStatus,
                             CASE fn_GetUserPermission(:p_UserID, DatasetID)
                                  WHEN 2 THEN SMfn_GetSpecifiedRow(:p_UserPermission, 1)
                                  ELSE
                                       CASE IsDataset
                                            WHEN 0 THEN ''''
                                            ELSE SMfn_GetSpecifiedRow(:p_UserPermission, 2)
                                       END
                             END AS UStatus,
                             SMfn_DatasetHasChildren(DatasetID) as HasChildren,
                             :p_RoleID as RoleID
                        FROM datasets
                        WHERE     Level_ = :v_iLevel';
              raise_application_error(-20001, v_SQL);
              execute immediate v_SQL
                   using     p_SupplierID, p_SupplierStatus, p_SupplierStatus, p_SupplierStatus, p_SupplierStatus,
                        p_SupplierStatus, p_SupplierStatus, p_UserID, p_UserPermission, p_UserPermission, p_RoleID, v_iLevel;
    What I am trying to do is to populate the cursor using a dynamic query, so that I can change cursor name each time.
    All functions used exist, and still I get this error: Invalid SQL statement.
    Is it possible to populate a cursor which is a parameter to the procedure (ref cursor) with a dynamic query ?
    Thanks.

    this is the query that gets executed:
    OPEN RCT1 FOR
                   SELECT     datasets.*,
                        CASE fn_GetSupplierStatus(:p_SupplierID, DatasetID)
                             WHEN 1 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 1)
                             WHEN 3 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 2)
                             WHEN 4 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 3)
                             WHEN 5 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 4)
                             ELSE
                                  CASE IsDataset
                                       WHEN 0 THEN SMfn_GetSpecifiedRow(:p_SupplierStatus, 5)
                                       ELSE SMfn_GetSpecifiedRow(:p_SupplierStatus, 5)
                                  END
                             END AS CStatus,
                             CASE fn_GetUserPermission(:p_UserID, DatasetID)
                                  WHEN 2 THEN SMfn_GetSpecifiedRow(:p_UserPermission, 1)
                                  ELSE
                                       CASE IsDataset
                                            WHEN 0 THEN ''
                                            ELSE SMfn_GetSpecifiedRow(:p_UserPermission, 2)
                                       END
                             END AS UStatus,
                             SMfn_DatasetHasChildren(DatasetID) as HasChildren,
                             :p_RoleID as RoleID
                        FROM datasets
                        WHERE     Level_ = :v_iLevel
    The select works fine (without "Open RCT1 FOR") if I try to run it, but when trying to populate the cursor, I get the error Ivalid SQL statement.

  • What's wrong with this query--need help

    Requirement: need to get the names of employees who were hired on tuesday this has to use to_char function
    select ename
    from emp
    where to_char(hiredate,'day')='tuesday';
    when i execute the query
    o/p is no rows selected
    please help.
    thanks in advance.

    Hi,
    861173 wrote:
    Requirement: need to get the names of employees who were hired on tuesday this has to use to_char function
    select ename
    from emp
    where to_char(hiredate,'day')='tuesday';
    when i execute the query
    o/p is no rows selected Try:
    WHERE   TO_CHAR (hiredate, 'fmday')  = 'tuesday'Without 'FM" in the 2nd argument, TO_CHAR pads the results to make it a consistent length. If your NLS_DATE_LANGUAGE=ENGLISH, that means it will always return a 9-character string, since the longest name in English ('Wednesday') has 9 letters. 'FM' (case-insernsitive) tells TO_CHAR not to add that kind of padding.

  • Any see what is wrong with this query?

    Logs Record Set - query - Top 4 of 4 Rows
    ATTRIBUTES DATELASTMODIFIED DIRECTORY MODE NAME SIZE TYPE
    1 [empty string] 06/06/2007 10:59:17 AM
    G:\Tracker\wwwRoot\Data
    [empty string] ChargedOut_06Jun2007_ILS_105634322.txt 828
    File
    2 [empty string] 06/06/2007 10:57:00 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Error_06Jun2007_ ILS_105634322.txt 88 File
    3 [empty string] 06/06/2007 10:58:46 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Final_06Jun2007_ ILS_105634322.txt 27841 File
    4 [empty string] 06/06/2007 10:56:07 AM
    G:\Tracker\wwwRoot\Data
    [empty string] Upload_06Jun2007_ ILS_105634322.txt 94768 File
    ChargeOut Stats - struct
    CACHED false
    COLUMNLIST NAME
    EXECUTIONTIME 0
    RECORDCOUNT 0
    SQL SELECT Name FROM Logs WHERE Name = 'ChargedOut_06Jun2007_
    ILS_105634322.txt'
    chargeOut Record Set - query - Top 0 of 0 Rows
    NAME
    CODE
    <cfdirectory directory="#ExpandPath('data')#"
    action="list" name="Logs"
    sort="Name">
    <cfquery dbtype="query" name="ChargedOut"
    result="stats">
    SELECT Name
    FROM Logs
    WHERE Name = 'ChargedOut#Set#.txt'
    </cfquery>
    I can not see why SELECT Name FROM Logs WHERE Name =
    'ChargedOut_06Jun2007_ ILS_105634322.txt' is not returning
    the
    corresponding record from the logs record set.

    Thanks, I finally saw the errant white space character!

  • What is wrong With My Query

    Pleas what is wrong with this query
         select h.business_unit_id bu, h.edi_sequence_id seq, d.edi_det_sequ_id dseq, s.edi_size_sequ_id sseq, h.po_number po, h.total_unit tUnit, h.total_amount tDollar, s.quantity qty, s.unit_price price,
    (select (case when count(*) = 0 then 'N' else 'Y' end)
    from(select s.business_unit_id, s.edi_sequence_id, s.edi_det_sequ_id, s.edi_size_sequ_id
    from sewn.nt_edii_purchase_size s
    where s.business_unit_id='01'
    and s.edi_sequence_id = '168420'
    and (s.edi_sequence_id, s.edi_det_sequ_id, s.edi_size_sequ_id) not in
    (select edi_sequence_id, edi_det_sequ_id, edi_size_sequ_id
    from sewn.nt_edii_po_det_error
    where business_unit_id = '01'
    and edi_sequence_id='168420'
    and error_code in(select error_code
    from sewn.nt_edii_error_codes
    where severity='CR'))))eligible
    from sewn.nt_edii_purchase_size s, sewn.nt_edii_purchase_det d,
    sewn.nt_edii_purchase_hdr h
    where h.business_unit_id = '01'
    and h.edi_sequence_id = '168420'
    and h.business_unit_id = d.business_unit_id
    and h.edi_sequence_id = d.edi_sequence_id
    and d.business_unit_id = s.business_unit_id
    and d.edi_sequence_id = s.edi_sequence_id
    and d.edi_det_sequ_id = s.edi_det_sequ_id
    group by h.business_unit_id, h.edi_sequence_id, d.edi_det_sequ_id,
    s.edi_size_sequ_id,h.po_number, h.total_unit, h.total_amount, s.quantity,s.unit_price

    Never mind, I got it working

  • Can someone tell me what's wrong with this LOV query please?

    This query works fine..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = 'ADAM'
    But this one..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = apex_application.g_user
    Gives the following error.
    1 error has occurred
    * LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    Thanks very much,
    -Adam vonNieda

    Ya know, I still don't know what's wrong with this.
    declare
    l_val varchar2(100) := nvl(apex_application.g_user,'ADAM');
    begin
    return 'select filter_name display_value, filter_id return_value
    from otmgui_filter where username = '''|| l_val || '''';
    end;
    Gets the same error as above. All I'm trying to do is create a dropdown LOV which selects based on the apex_application.g_user.
    What am I missing here?
    Thanks,
    -Adam

  • Whats wrong with this query.can anyone help me......

    select CASE WHEN TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0 AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
    THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)||'00',SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),'DD-MM-YYYY HH24:MI:SS') end
    from table;
    i have written this query.whats wrong with this query..........
    the error is "literal does not match format string"
    Reegards soumen

    Why does your date_format loose, ununify and not fix ?
    And what is your exact requirement?
    >>
    CASE WHEN
    TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0
    AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
    <<
    This is
    CASE WHEN TO_CHAR(START_TIME_TIMESTAMP,'MM') between '01' and '13'
    >>
    THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)
    ||'00',
    SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),
    'DD-MM-YYYY HH24:MI:SS')
    <<
    This is
    TO_DATE(
    TO_CHAR(START_TIME_TIMESTAMP,'MM"00"SS"00"),
    'DD-MM-YYYY HH24:MI:SS')
    Obviously, format is not matching !
    SQL> select to_char(sysdate,'MM"00"SS"00') from dual;
    TO_CHAR(
    06004900
    SQL> select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual;
    select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual
    ERROR at line 1:
    ORA-01861: literal does not match format string

  • What's wrong with this SQL?

    what's wrong with this SQL?
    Posted: Jan 16, 2007 9:35 AM Reply
    Hi, everyone:
    when I insert into table, i use the fellowing SQL:
    INSERT INTO xhealthcall_script_data
    (XHC_CALL_ENDED, XHC_SWITCH_PORT, XHC_SCRIPT_ID, XHC_FAX_SPECIFIED)
    VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N'
    FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION
    SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
    I always got an error like;
    VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT,
    ERROR at line 3:
    ORA-00936: missing expression
    but I can't find anything wrong, who can tell me why?
    thank you so much in advance
    mpowel01
    Posts: 1,516
    Registered: 12/7/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:38 AM in response to: jerrygreat Reply
    For starters, an insert select does not have a values clause.
    HTH -- Mark D Powell --
    PP
    Posts: 41
    From: q
    Registered: 8/10/06
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:48 AM in response to: mpowel01 Reply
    Even I see "missing VALUES" as the only error
    Eric H
    Posts: 2,822
    Registered: 10/15/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:54 AM in response to: jerrygreat Reply
    ...and why are you doing a UNION on the exact same two queries?
    (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:55 AM in response to: mpowel01 Reply
    Hi,
    thank you for your answer, but the problem is, if I deleted "values" as you pointed out, and then execute it again, I got error like "ERROR at line 3:
    ORA-03113: end-of-file on communication channel", and I was then disconnected with server, I have to relogin SQLplus, and do everything from beganing.
    so what 's wrong caused disconnection, I can't find any triggers related. it is so wired?
    I wonder if anyone can help me about this.
    thank you very much
    jerry
    yingkuan
    Posts: 1,801
    From: San Jose, CA
    Registered: 10/8/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:59 AM in response to: jerrygreat Reply
    Dup Post
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:00 AM in response to: Eric H Reply
    Hi,
    acturlly what I do is debugging a previous developer's scipt for data loading, this script was called by Cron work, but it never can be successfully executed.
    I think he use union for eliminating duplications of rows, I just guess.
    thank you
    jerry
    mpowel01
    Posts: 1,516
    Registered: 12/7/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:03 AM in response to: yingkuan Reply
    Scratch the VALUES keyword then make sure that the select list matches the column list in number and type.
    1 insert into marktest
    2 (fld1, fld2, fld3, fld4, fld5)
    3* select * from marktest
    UT1 > /
    16 rows created.
    HTH -- Mark D Powell --
    Jagan
    Posts: 41
    From: Hyderabad
    Registered: 7/21/06
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:07 AM in response to: jerrygreat Reply
    try this - just paste the code and give me the error- i mean past the entire error as it is if error occurs
    INSERT INTO xhealthcall_script_data
    (xhc_call_ended, xhc_switch_port, xhc_script_id,
    xhc_fax_specified)
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE'
    UNION
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE';
    Regards
    Jagan
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 11:31 AM in response to: Jagan Reply
    Hi, Jagan:
    thank you very much for your answer.
    but when I execute it, I still can get error like:
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    so wired, do you have any ideas?
    thank you very much

    And this one,
    Aother question about SQL?
    I thought I already told him to deal with
    ORA-03113: end-of-file on communication channel
    problem first.
    There's nothing wrong (syntax wise) with the query. (of course when no "value" in the insert)

  • Please tell me anything wrong in this query please help me follwing query

    SELECT o100161.ORG_STRUCTURE_VERSION_ID as E100351,AVG(o100163.PLANNED) as E100360_AVG,AVG(o100163.ACTUAL) as E100180_AVG,( SUM(fx102) )-( SUM(fx103) ) as C_1,( SUM(fx105) )-( SUM(fx106) ) as C_2,( SUM(fx108) )-( SUM(fx109) ) as C_3
    FROM ( SELECT o100165.SEGMENT1 AS fx100, SUM(o100165.ACR) AS fx102, SUM(o100165.ADR) AS fx103, SUM(o100165.BDR) AS fx105, SUM(o100165.BCR) AS fx106, SUM(o100165.ECR) AS fx108, SUM(o100165.EDR) AS fx109 FROM ( SELECT
    nvl(src.user_je_source_name, '**************') SOURCE,
    nvl(cat.user_je_category_name, '**************') CATEGORY,
    jeh.name NAME,
    jel.code_combination_id CCID,
    jeh.DEFAULT_EFFECTIVE_DATE,
    jel.period_name PERIOD_NAME,
    jel.effective_date EFFECTIVE_DATE,
    jel.description DESCRIPTION,
    seq.name SEQUENCE_NAME,
    jeh.doc_sequence_value DOCUMENT_NUMBER,
    jel.accounted_dr,
    jel.accounted_cr,
    decode(jeh.actual_flag,'B',jel.accounted_dr,'E',0,'A',0)bdr,
    decode(jeh.actual_flag,'B',jel.accounted_Cr,'E',0,'A',0)bcr,
    decode(jeh.actual_flag,'B',0,'E',jel.accounted_Dr,'A',0)EDr,
    decode(jeh.actual_flag,'B',0,'E',jel.accounted_Cr,'A',0)ECr,
    decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Dr)ADr,
    decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Cr)ACr,
    jel.JE_LINE_NUM,
    cc.segment7 Project_COA_No,
    cc.description Segment_description,
    pa.segment1,
    jeh.actual_flag,
    PA.NAME PROJECT_NAME,
    cc.segment1||'.'||cc.segment2||'.'||cc.segment3||'.'||cc.segment4||'.'||cc.segment5 seg_desc
    FROM gl_je_lines jel,
    gl_code_combinations cc,
    gl_je_headers jeh,
    -- gl_je_batches jeb,
    gl_je_categories cat,
    gl_je_sources src,
    fnd_document_sequences seq,
    pa_projects_all pa,
    XXEPM_FINANCE_INTEGRATION XX
    WHERE
    ((nvl(accounted_dr,0) != 0 OR nvl(accounted_cr,0) != 0) OR
    (nvl(accounted_dr,0) = 0 AND nvl(accounted_cr,0) = 0 AND
    stat_amount is not NULL))
    AND jeh.je_header_id = jel.je_header_id
    AND src.je_source_name = jeh.je_source
    AND cat.je_category_name = jeh.je_category
    AND seq.doc_sequence_id(+) = jeh.doc_sequence_id
    AND jel.code_combination_id = cc.code_combination_id
    AND XX.EPM_PA_NO=PA.SEGMENT1
    AND XX.FINANCE_PA_COA_SEG=CC.SEGMENT7
    ORDER BY jeh.name, jel.je_line_num
    ) o100165 GROUP BY o100165.SEGMENT1) ,
    ( select * from PER_ORG_STRUCTURE_ELEMENTS_V
    ) o100161,
    ( SELECT PPA.CARRYING_OUT_ORGANIZATION_ID Organization, PPA.PROJECT_ID as "Project ID",ppa.segment1 as "Project No" ,PPA.NAME as "Project Name",
    nvl(trunc(((sysdate - PPA.SCHEDULED_START_DATE)/( PPA.scheduled_finish_date - PPA.SCHEDULED_START_DATE) *100 )),0) Planned,
    nvl(TRUNC(AVG(PPC.COMPLETED_PERCENTAGE)),0) Actual
    FROM PA_PROJECTS_ALL PPA , PA_PERCENT_COMPLETES PPC
    WHERE PPA.CARRYING_OUT_ORGANIZATION_ID IN (SELECT A.ORGANIZATION_ID_CHILD
    FROM PER_ORG_STRUCTURE_ELEMENTS_V A, PA_IMPLEMENTATIONS_ALL B
    WHERE A.ORG_STRUCTURE_VERSION_ID= B.ORG_STRUCTURE_VERSION_ID)
    AND PPA.TEMPLATE_FLAG='N'
    AND PPC.PROJECT_ID(+) = PPA.PROJECT_ID
    GROUP BY PPA.CARRYING_OUT_ORGANIZATION_ID,PPA.PROJECT_ID,ppa.segment1, PPA.NAME ,PPA.SCHEDULED_START_DATE,PPA.scheduled_finish_date
    ) o100163
    WHERE ( (o100163."Project No" = fx100)
    and (o100161.ORGANIZATION_ID_CHILD = o100163.ORGANIZATION))
    GROUP BY o100161.ORG_STRUCTURE_VERSION_ID;
    the second query is as follows
    SELECT o100163."Project Name" as E100386,( SUM(o100165.ACR) )-( SUM(o100165.ADR) ) as C_1,( SUM(o100165.BDR) )-( SUM(o100165.BCR) ) as C_2,( SUM(o100165.ECR) )-( SUM(o100165.EDR) ) as C_3
    FROM ( SELECT PPA.CARRYING_OUT_ORGANIZATION_ID Organization, PPA.PROJECT_ID as "Project ID",ppa.segment1 as "Project No" ,PPA.NAME as "Project Name",
    nvl(trunc(((sysdate - PPA.SCHEDULED_START_DATE)/( PPA.scheduled_finish_date - PPA.SCHEDULED_START_DATE) *100 )),0) Planned,
    nvl(TRUNC(AVG(PPC.COMPLETED_PERCENTAGE)),0) Actual
    FROM PA_PROJECTS_ALL PPA , PA_PERCENT_COMPLETES PPC
    WHERE PPA.CARRYING_OUT_ORGANIZATION_ID IN (SELECT A.ORGANIZATION_ID_CHILD
    FROM PER_ORG_STRUCTURE_ELEMENTS_V A, PA_IMPLEMENTATIONS_ALL B
    WHERE A.ORG_STRUCTURE_VERSION_ID= B.ORG_STRUCTURE_VERSION_ID)
    AND PPA.TEMPLATE_FLAG='N'
    AND PPC.PROJECT_ID(+) = PPA.PROJECT_ID
    GROUP BY PPA.CARRYING_OUT_ORGANIZATION_ID,PPA.PROJECT_ID,ppa.segment1, PPA.NAME ,PPA.SCHEDULED_START_DATE,PPA.scheduled_finish_date
    ) o100163,
    ( SELECT
    nvl(src.user_je_source_name, '**************') SOURCE,
    nvl(cat.user_je_category_name, '**************') CATEGORY,
    jeh.name NAME,
    jel.code_combination_id CCID,
    jeh.DEFAULT_EFFECTIVE_DATE,
    jel.period_name PERIOD_NAME,
    jel.effective_date EFFECTIVE_DATE,
    jel.description DESCRIPTION,
    seq.name SEQUENCE_NAME,
    jeh.doc_sequence_value DOCUMENT_NUMBER,
    jel.accounted_dr,
    jel.accounted_cr,
    decode(jeh.actual_flag,'B',jel.accounted_dr,'E',0,'A',0)bdr,
    decode(jeh.actual_flag,'B',jel.accounted_Cr,'E',0,'A',0)bcr,
    decode(jeh.actual_flag,'B',0,'E',jel.accounted_Dr,'A',0)EDr,
    decode(jeh.actual_flag,'B',0,'E',jel.accounted_Cr,'A',0)ECr,
    decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Dr)ADr,
    decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Cr)ACr,
    jel.JE_LINE_NUM,
    cc.segment7 Project_COA_No,
    cc.description Segment_description,
    pa.segment1,
    jeh.actual_flag,
    PA.NAME PROJECT_NAME,
    cc.segment1||'.'||cc.segment2||'.'||cc.segment3||'.'||cc.segment4||'.'||cc.segment5 seg_desc
    FROM gl_je_lines jel,
    gl_code_combinations cc,
    gl_je_headers jeh,
    -- gl_je_batches jeb,
    gl_je_categories cat,
    gl_je_sources src,
    fnd_document_sequences seq,
    pa_projects_all pa,
    XXEPM_FINANCE_INTEGRATION XX
    WHERE
    ((nvl(accounted_dr,0) != 0 OR nvl(accounted_cr,0) != 0) OR
    (nvl(accounted_dr,0) = 0 AND nvl(accounted_cr,0) = 0 AND
    stat_amount is not NULL))
    AND jeh.je_header_id = jel.je_header_id
    AND src.je_source_name = jeh.je_source
    AND cat.je_category_name = jeh.je_category
    AND seq.doc_sequence_id(+) = jeh.doc_sequence_id
    AND jel.code_combination_id = cc.code_combination_id
    AND XX.EPM_PA_NO=PA.SEGMENT1
    AND XX.FINANCE_PA_COA_SEG=CC.SEGMENT7
    ORDER BY jeh.name, jel.je_line_num
    ) o100165
    WHERE ( (o100163."Project No" = o100165.SEGMENT1))
    GROUP BY o100163."Project Name";

    > please tell me anything wrong in this query
    Umm, it's completely unreadable?
    Even formatted (with a little help from the wangz.net online SQL formatter, though it needed some manual editing) it's pretty hard to see what it's meant to be doing, due to all the nesting and cryptic naming. This is just the first one:
    SELECT o100161.org_structure_version_id AS e100351
         , AVG(o100163.planned) AS e100360_avg
         , AVG(o100163.actual) AS e100180_avg
         , SUM(fx102) - SUM(fx103) AS c_1
         , SUM(fx105) - SUM(fx106) AS c_2
         , SUM(fx108) - SUM(fx109) AS c_3
    FROM   ( SELECT o100165.segment1 AS fx100
                  , SUM(o100165.acr) AS fx102
                  , SUM(o100165.adr) AS fx103
                  , SUM(o100165.bdr) AS fx105
                  , SUM(o100165.bcr) AS fx106
                  , SUM(o100165.ecr) AS fx108
                  , SUM(o100165.edr) AS fx109
             FROM   GG( SELECT NVL(src.user_je_source_name,'**************') source
                           , NVL(cat.user_je_category_name,'**************') category
                           , jeh.NAME NAME
                           , jel.code_combination_id ccid
                           , jeh.default_effective_date
                           , jel.period_name period_name
                           , jel.effective_date effective_date
                           , jel.description description
                           , seq.NAME sequence_name
                           , jeh.doc_sequence_value document_number
                           , jel.accounted_dr
                           , jel.accounted_cr
                           , DECODE(jeh.actual_flag, 'B',jel.accounted_dr, 'E',0, 'A',0) bdr
                           , DECODE(jeh.actual_flag, 'B',jel.accounted_cr, 'E',0, 'A',0) bcr
                           , DECODE(jeh.actual_flag, 'B',0, 'E',jel.accounted_dr, 'A',0) edr
                           , DECODE(jeh.actual_flag, 'B',0, 'E',jel.accounted_cr, 'A',0) ecr
                           , DECODE(jeh.actual_flag, 'B',0, 'E',0, 'A',jel.accounted_dr) adr
                           , DECODE(jeh.actual_flag, 'B',0, 'E',0, 'A',jel.accounted_cr) acr
                           , jel.je_line_num
                           , cc.segment7 project_coa_no
                           , cc.description segment_description
                           , pa.segment1
                           , jeh.actual_flag
                           , pa.NAME project_name
                           , cc.segment1 ||'.' ||cc.segment2 ||'.' ||cc.segment3 ||'.'
                           ||cc.segment4 ||'.' ||cc.segment5 seg_desc
                      FROM   gl_je_lines jel
                           , gl_code_combinations cc
                           , gl_je_headers jeh
                           , gl_je_categories cat
                           , gl_je_sources src
                           , fnd_document_sequences seq
                           , pa_projects_all pa
                           , xxepm_finance_integration xx
                      WHERE  (    ( NVL(accounted_dr,0) != 0 OR NVL(accounted_cr,0) != 0 )
                              OR  (    NVL(accounted_dr,0) = 0
                                   AND NVL(accounted_cr,0) = 0
                                   AND stat_amount IS NOT NULL ) )
                      AND    jeh.je_header_id = jel.je_header_id
                      AND    src.je_source_name = jeh.je_source
                      AND    cat.je_category_name = jeh.je_category
                      AND    seq.doc_sequence_id (+)  = jeh.doc_sequence_id
                      AND    jel.code_combination_id = cc.code_combination_id
                      AND    xx.epm_pa_no = pa.segment1
                      AND    xx.finance_pa_coa_seg = cc.segment7
                      ORDER BY jeh.NAME, jel.je_line_num) o100165
              GROUP BY o100165.segment1)
         , ( SELECT *
             FROM   per_org_structure_elements_v) o100161
         , ( SELECT ppa.carrying_out_organization_id organization
                  , ppa.project_id AS "Project ID"
                  , ppa.segment1 AS "Project No"
                  , ppa.NAME AS "Project Name"
                  , NVL
                    ( TRUNC
                      ( ( (SYSDATE - ppa.scheduled_start_date) /
                          (ppa.scheduled_finish_date - ppa.scheduled_start_date) * 100)
                    , 0) planned
                  , NVL(TRUNC(AVG(ppc.completed_percentage)),0) actual
             FROM   pa_projects_all ppa
                  , pa_percent_completes ppc
             WHERE  ppa.carrying_out_organization_id IN
                    ( SELECT a.organization_id_child
                      FROM   per_org_structure_elements_v a
                           , pa_implementations_all b
                      WHERE  a.org_structure_version_id = b.org_structure_version_id )
             AND    ppa.template_flag = 'N'
             AND ppc.project_id (+)  = ppa.project_id
             GROUP BY
                    ppa.carrying_out_organization_id
                  , ppa.project_id
                  , ppa.segment1
                  , ppa.NAME
                  , ppa.scheduled_start_date
                  , ppa.scheduled_finish_date ) o100163
    WHERE  o100163."Project No" = fx100
    AND    o100161.organization_id_child = o100163.organization
    GROUP BY o100161.org_structure_version_id;

  • What is wrong with this code? on(release) gotoAndPlay("2")'{'

    Please could someone tell me what is wrong with this code - on(release)
    gotoAndPlay("2")'{'
    this is the error that comes up and i have tried changing it but it is not working
    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 2: '{' expected
         gotoAndPlay("2")'{'
    Total ActionScript Errors: 1 Reported Errors: 1
    Thanks

    If you have a frame labelled "2" then it should be:
    on (release) {
        this._parent.gotoAndPlay("2");
    or other wise just the following to go to frame 2:
    on (release) {
         this._parent.gotoAndPlay(2);
    You just had a missing curly bracket...

  • It says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?

    I just got my new iPad Mini2, and when I choose "sign in with your apple ID", it says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?

    1. Turn router off for 30 seconds and on again
    2. Settings>General>Reset>Reset Network Settings

  • I can't figure out what's wrong with this code

    First i want this program to allow me to enter a number with the EasyReader class and depending on the number entered it will show that specific line of this peom:
    One two buckle your shoe
    Three four shut the door
    Five six pick up sticks
    Seven eight lay them straight
    Nine ten this is the end.
    The error message i got was an illegal start of expression. I can't figure out why it is giving me this error because i have if (n = 1) || (n = 2) statements. My code is:
    public class PoemSeventeen
    public static void main(String[] args)
    EasyReader console = new EasyReader();
    System.out.println("Enter a number for the poem (0 to quit): ");
    int n = console.readInt();
    if (n = 1) || (n = 2)
    System.out.println("One, two, buckle your shoe");
    else if (n = 3) || (n = 4)
    System.out.println("Three, four, shut the door");
    else if (n = 5) || (n = 6)
    System.out.println("Five, six, pick up sticks");
    else if (n = 7) || (n = 8)
    System.out.println("Seven, eight, lay them straight");
    else if (n = 9) || (n = 10)
    System.out.println("Nine, ten, this is the end");
    else if (n = 0)
    System.out.println("You may exit now");
    else
    System.out.println("Put in a number between 0 and 10");
    I messed around with a few other thing because i had some weird errors before but now i have narrowed it down to just this 1 error.
    The EasyReader class code:
    // package com.skylit.io;
    import java.io.*;
    * @author Gary Litvin
    * @version 1.2, 5/30/02
    * Written as part of
    * <i>Java Methods: An Introduction to Object-Oriented Programming</i>
    * (Skylight Publishing 2001, ISBN 0-9654853-7-4)
    * and
    * <i>Java Methods AB: Data Structures</i>
    * (Skylight Publishing 2003, ISBN 0-9654853-1-5)
    * EasyReader provides simple methods for reading the console and
    * for opening and reading text files. All exceptions are handled
    * inside the class and are hidden from the user.
    * <xmp>
    * Example:
    * =======
    * EasyReader console = new EasyReader();
    * System.out.print("Enter input file name: ");
    * String fileName = console.readLine();
    * EasyReader inFile = new EasyReader(fileName);
    * if (inFile.bad())
    * System.err.println("Can't open " + fileName);
    * System.exit(1);
    * String firstLine = inFile.readLine();
    * if (!inFile.eof()) // or: if (firstLine != null)
    * System.out.println("The first line is : " + firstLine);
    * System.out.print("Enter the maximum number of integers to read: ");
    * int maxCount = console.readInt();
    * int k, count = 0;
    * while (count < maxCount && !inFile.eof())
    * k = inFile.readInt();
    * if (!inFile.eof())
    * // process or store this number
    * count++;
    * inFile.close(); // optional
    * System.out.println(count + " numbers read");
    * </xmp>
    public class EasyReader
    protected String myFileName;
    protected BufferedReader myInFile;
    protected int myErrorFlags = 0;
    protected static final int OPENERROR = 0x0001;
    protected static final int CLOSEERROR = 0x0002;
    protected static final int READERROR = 0x0004;
    protected static final int EOF = 0x0100;
    * Constructor. Prepares console (System.in) for reading
    public EasyReader()
    myFileName = null;
    myErrorFlags = 0;
    myInFile = new BufferedReader(
    new InputStreamReader(System.in), 128);
    * Constructor. opens a file for reading
    * @param fileName the name or pathname of the file
    public EasyReader(String fileName)
    myFileName = fileName;
    myErrorFlags = 0;
    try
    myInFile = new BufferedReader(new FileReader(fileName), 1024);
    catch (FileNotFoundException e)
    myErrorFlags |= OPENERROR;
    myFileName = null;
    * Closes the file
    public void close()
    if (myFileName == null)
    return;
    try
    myInFile.close();
    catch (IOException e)
    System.err.println("Error closing " + myFileName + "\n");
    myErrorFlags |= CLOSEERROR;
    * Checks the status of the file
    * @return true if en error occurred opening or reading the file,
    * false otherwise
    public boolean bad()
    return myErrorFlags != 0;
    * Checks the EOF status of the file
    * @return true if EOF was encountered in the previous read
    * operation, false otherwise
    public boolean eof()
    return (myErrorFlags & EOF) != 0;
    private boolean ready() throws IOException
    return myFileName == null || myInFile.ready();
    * Reads the next character from a file (any character including
    * a space or a newline character).
    * @return character read or <code>null</code> character
    * (Unicode 0) if trying to read beyond the EOF
    public char readChar()
    char ch = '\u0000';
    try
    if (ready())
    ch = (char)myInFile.read();
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    if (ch == '\u0000')
    myErrorFlags |= EOF;
    return ch;
    * Reads from the current position in the file up to and including
    * the next newline character. The newline character is thrown away
    * @return the read string (excluding the newline character) or
    * null if trying to read beyond the EOF
    public String readLine()
    String s = null;
    try
    s = myInFile.readLine();
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    if (s == null)
    myErrorFlags |= EOF;
    return s;
    * Skips whitespace and reads the next word (a string of consecutive
    * non-whitespace characters (up to but excluding the next space,
    * newline, etc.)
    * @return the read string or null if trying to read beyond the EOF
    public String readWord()
    StringBuffer buffer = new StringBuffer(128);
    char ch = ' ';
    int count = 0;
    String s = null;
    try
    while (ready() && Character.isWhitespace(ch))
    ch = (char)myInFile.read();
    while (ready() && !Character.isWhitespace(ch))
    count++;
    buffer.append(ch);
    myInFile.mark(1);
    ch = (char)myInFile.read();
    if (count > 0)
    myInFile.reset();
    s = buffer.toString();
    else
    myErrorFlags |= EOF;
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    return s;
    * Reads the next integer (without validating its format)
    * @return the integer read or 0 if trying to read beyond the EOF
    public int readInt()
    String s = readWord();
    if (s != null)
    return Integer.parseInt(s);
    else
    return 0;
    * Reads the next double (without validating its format)
    * @return the number read or 0 if trying to read beyond the EOF
    public double readDouble()
    String s = readWord();
    if (s != null)
    return Double.parseDouble(s);
    // in Java 1, use: return Double.valueOf(s).doubleValue();
    else
    return 0.0;
    Can anybody please tell me what's wrong with this code? Thanks

    String[] message = {
        "One, two, buckle your shoe",
        "One, two, buckle your shoe",
        "Three, four, shut the door",
        "Three, four, shut the door",
        "Five, six, pick up sticks",
        "Five, six, pick up sticks",
        "Seven, eight, lay them straight",
        "Seven, eight, lay them straight",
        "Nine, ten, this is the end",
        "Nine, ten, this is the end"
    if(n>0)
        System.out.println(message[n]);
    else
        System.exit(0);

  • What's wrong with this function

    What's wrong with this Function(PL/SQL) in this formaula column definition in Reports 6i
    function currdateFormula return Date is
    curr_date date;
    begin
    select to_char(sysdate, 'DD-MM-YYYY') into curr_date from dual;
    return(curr_date);
    end;
    I get the following error in compiling
    REP-1401. 'currdateformula'.Fatal PL/SQL error occured. ORA-01843 not a valid month.
    The SQL select to_char(sysdate, 'DD-MM-YYYY') from dual; worked well in SQL Plus prompt.
    I got a clean compile when i use just sysdate in the function (see below).
    function currdateFormula return Date is
    curr_date date;
    begin
    select sysdate into curr_date from dual;
    return(curr_date);
    end;
    Appreciate your help
    Raja Lakshmi

    hello,
    what you are trying to do :
    fetch the current date and return it as the result of the formula-column.
    what you are actually doing :
    fetch the current date, convert it to text, assign this text to a date-variable which causes an implicit type-conversion.
    in your case you create a date-string with the format dd-mm-yyyy. the implicit conversion then tries to convert this string back to date using the NLS settings of your session. depending on your NLS_LANG and NLS_DATE_FORMAT this might work, if your session-date-format is dd-mm-yyyy which obviously it is NOT as you get the error.
    what you should do :
    select sysdate into curr_date from dual;
    this fetches the sysdate and stores it in your date-variable. there is no type conversion needed what so ever.
    regards,
    the oracle reports team

  • I HATE my new MACBOOK PRO, it will not let me open any PDF files and I downloaded the ADOBE READER three freaking times and it keeps saying that all the files are corrupt. I would rather have my 2008 Dell at this point. what is wrong with this thing

    I HATE my new MACBOOK PRO, it will not let me open any PDF files and I downloaded the ADOBE READER three freaking times and it keeps saying that all the files are corrupt or damaged. I would rather have my 2008 Dell at this point. what is wrong with this thing

    Perhaps the PDF files are corrupted.
    Hit the command key and spacebar, a blue Spotlight in the upper right hand corner appears, now type Preview and press return on the Preview program.
    Now you can try opening the PDF's from the file menu and see what's going on.
    If they are corrupted, perhaps they are trojans from your Windows PC or gotten from a bad location online.
    Download the free ClamXav and run a scan on the possibly infected folder.

Maybe you are looking for