PLSQL and to_date query returning error...

I'm sure this has something to do with a conversion which I'm not understanding however :
Metric_date field is a DATE type field in the database.
DECLARE
disknum NUMBER;
diskcost NUMBER;
fystart VARCHAR(20):='01-JUN-'||(:FINANCE_FY-1);
fyend VARCHAR(20):='31-MAY-'||:FINANCE_FY;
BEGIN
select metric_value into disknum from
   (SELECT metric_value from core_metrics where metric_subname='TIER_1_DISK_NUMBER' and metric_date between to_date(fystart,'DD-MON-YYYY') and to_date(fyend,'DD-MON-YYYY')  order by metric_date DESC)
where rownum=1;
select metric_value into diskcost from
(SELECT metric_value from core_metrics where metric_subname='TIER_1_COST_PER_DISK' and metric_date between to_date(fystart,'DD-MON-YYYY') and to_date(fyend,'DD-MON-YYYY') order by metric_date DESC)
where rownum=1;
RETURN to_char((disknum*diskcost)/5,'$999,999,999');
END;When executed I get
Error computing item source value for page item P17_VMAX_TIER1_DISK_COST_SUM.
ORA-01840: input value not long enough for date format
Technical Info (only visible for developers)
is_internal_error: true
apex_error_code: WWV_FLOW_FORMS.ITEM_SOURCE_ERR
ora_sqlcode: -1840
ora_sqlerrm: ORA-01840: input value not long enough for date format
component.type: APEX_APPLICATION_PAGE_ITEMS
component.id: 14284527609957008
component.name: P17_VMAX_TIER1_DISK_COST_SUM
error_backtrace:
ORA-06512: at line 8
ORA-06512: at line 19
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1926
ORA-06512: at "SYS.WWV_DBMS_SQL", line 966
ORA-06512: at "SYS.WWV_DBMS_SQL", line 992
ORA-06512: at "APEX_040100.WWV_FLOW_DYNAMIC_EXEC", line 503
ORA-06512: at "APEX_040100.WWV_FLOW_FORMS", line 611Edited by: bostonmacosx on Mar 28, 2013 2:42 PM

Thanks for all the help and I'm close to getting this nailed down:
DECLARE
defnumber NUMBER:=0;
disknum NUMBER;
diskcost NUMBER;
fystart VARCHAR(20):='01-JUN-'||(:FINANCE_FY-1);
fyend VARCHAR(20):='31-MAY-'||:FINANCE_FY;
BEGIN
if :FINANCE_FY is NULL THEN
return 'hello';
end if;
select metric_value into disknum from
   (SELECT metric_value from core_metrics where metric_subname='TIER_1_DISK_NUMBER' and metric_date between to_date(fystart,'DD-MON-YYYY') and to_date(fyend,'DD-MON-YYYY')  order by metric_date DESC)
where rownum=1;
select metric_value into diskcost from
(SELECT metric_value from core_metrics where metric_subname='TIER_1_COST_PER_DISK' and metric_date between to_date(fystart,'DD-MON-YYYY') and to_date(fyend,'DD-MON-YYYY') order by metric_date DESC)
where rownum=1;
RETURN to_char((disknum*diskcost)/5,'$999,999,999');
EXCEPTION
WHEN NO_DATA_FOUND THEN
    return disknum;
END; What I am running into though is that I want to return some text if :Finance_FY is not set to let the user know what is happening. However the RETURN is not allowing me to return anything except one of my variables....in fact I can't even RETURN defnumber.
I thought I could return a string or a number.
The above is a function for a Page Item of type "Display Only"
The error I get is
Error computing item source value for page item P17_VMAX_OTHER_THAN_DISK.
ORA-06502: PL/SQL: numeric or value error
Technical Info (only visible for developers)
is_internal_error: true
apex_error_code: WWV_FLOW_FORMS.ITEM_SOURCE_ERR
ora_sqlcode: -6502
ora_sqlerrm: ORA-06502: PL/SQL: numeric or value error
component.type: APEX_APPLICATION_PAGE_ITEMS
component.id: 14298319812267057
component.name: P17_VMAX_OTHER_THAN_DISK
error_backtrace:
ORA-06512: at line 3
ORA-06512: at line 7
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1926
ORA-06512: at "SYS.WWV_DBMS_SQL", line 966
ORA-06512: at "SYS.WWV_DBMS_SQL", line 992
ORA-06512: at "APEX_040100.WWV_FLOW_DYNAMIC_EXEC", line 503
ORA-06512: at "APEX_040100.WWV_FLOW_FORMS", line 611

Similar Messages

  • ODBC functions SQLExecDirectW and SQLExecute functions return error:"DIAG [22001] [Microsoft][SQL Server Native Client 10.0]String data, right truncation (0) "

    Problem Description:
    ODBC functions SQLExecDirectW and SQLExecute functions return error:”DIAG [22001] [Microsoft][SQL Server Native Client 10.0]String data, right
    truncation (0) “. When we enable tracing in the ODBC administrator, in the SQL.log we see that values for the arguments: ColumnSize, BufferLength, and StrLen_or_IndPtr of ODBC function SQLBindParameter are not being displayed.
    Environment Used:
    OS: Microsoft Windows Server 2003 R2 Standard x64 Edition.
    Complier: Microsoft Visual Studio 2008 SP1 for x64.
    Database: Microsoft SQL Server 2008
    MDAC: Microsoft Data Access Components SDK 2.8
    Note: This problem is seen only in our 64bit application. However, in 32bit
    SQLExecDirectW and SQLExecute functions return successfully.
    As we could not find the values of 6<sup>th</sup>, 9<sup>th</sup> and 10<sup>th</sup> arguments(ColumnSize,
    BufferLength, and StrLen_or_IndPtr) passed to
    SQLBindParameter in the ODBC traces for 64bit, we are not sure whether the values for the above mentioned arguments are received correctly by SQLBindParameter or not. This information would help us to debug further. So, could you please let us know why
    these values are not displayed.
    1)Here is the extract of the SQL.log file for 32bit where the values for SQLULEN , SQLLEN and SQLLEN* are displayed properly:
    PR0CNFG 1028-15f0 ENTER SQLBindParameter
    HSTMT 0x006FBDD8
    UWORD 1
    SWORD 1 <SQL_PARAM_INPUT>
    SWORD -8 <SQL_C_WCHAR>
    SWORD -9 <SQL_WVARCHAR>
    SQLULEN 23
    SWORD 0
    PTR 0x0595EBBA
    SQLLEN 46
    SQLLEN * 0x05A5FB00
    2)Here is the extract of the SQL.log file for 64bit where the values for SQLULEN , SQLLEN are not displayed properly and
    SQLExecDirectW function return error:”DIAG
    [22001] [Microsoft][SQL Server Native Client 10.0]String data, right truncation (0) “. :
    PR0CNFG a78-fe4 ENTER SQLBindParameter
    HSTMT 000000000431D2F0
    UWORD 1
    SWORD 1 <SQL_PARAM_INPUT>
    SWORD -8 <SQL_C_WCHAR>
    SWORD -9 <SQL_WVARCHAR>
    SQLULEN SQLULEN SWORD 0
    PTR 0x0000000005364EFA
    SQLLEN SQLLEN
    SQLLEN * SQLLEN *
    PR0CNFG a78-fe4 EXIT SQLBindParameter with return code 0 (SQL_SUCCESS)
    HSTMT 000000000431D2F0
    UWORD 1
    SWORD 1 <SQL_PARAM_INPUT>
    SWORD -8 <SQL_C_WCHAR>
    SWORD -9 <SQL_WVARCHAR>
    SQLULEN SQLULEN SWORD 0
    PTR 0x0000000005364EFA
    SQLLEN SQLLEN SQLLEN *

    Hi Nalsr,
    From my research, I found:
    "[Microsoft][ODBC SQL Server Driver]String
    data right truncation" error may be returned from a call to
    SQLBindParameter if the size of the string parameter being used is greater than the size of the column being compared to. In other words if the
    string size of the <expression> to the left of the <comparison_operator> is less than the
    string size of the <expression> to the
    right, ODBC may return this error.
    The resolution is to make the string size of the <expression> to the
    right of the <comparison_operator> less than or equal to the
    string size of the <expression> on the left.
    It is difficult to track down this type of problem when third party development applications are being used. ODBC Trace can be used to help determine if this problem is occuring.
    Here is an example where the customer has submitted a query "select count(*) from type1 where type1 = ?", type1 is varchar(5) and the
    data type being passed by the application is char[9].
    Here is the relevant portion of the trace. The following information from the "exit" of SQLDescribeParam
    SWORD * 0x0095e898 (12)
    UDWORD * 0x0095e880 (5)
    Maps to the following with the actual value in parenthesis - SQL_VARCHAR Size 5:
    SQLSMALLINT *DataTypePtr
    SQLUINTEGER *ParameterSizePtr
    The "exit" value from SQLBindParameter provides the following
    information:
    SWORD 1 <SQL_PARAM_INPUT>
    SWORD 1 <SQL_C_CHAR>
    SQL Data Type SWORD 12 <SQL_VARCHAR>
    Parameter Size UDWORD 5
    SWORD 0
    Value PTR 0x0181c188
    Value Buffer Size SDWORD 5
    String Length SDWORD * 0x0181c103 (9)
    The string length parameter is the length of the
    string being bound to the parameter, in this instance there is a size mismatch which results in the SQLError and the SQLErrorW with the message "[Microsoft][ODBC SQL Server
    Driver]String data
    right truncation" .
    Hope this could be helpful.
    Best regards,
    Halin Huang

  • SSAS 2012 - Bring in Sold to Customer and measure - query returns in 1 second - add in ship to query stalls

    I have a star schema that has the Customer Dim hooked to the invoice fact 3 times.  Aliased Sold to, Ship to and End user.  I pull Sold to name into excel and any measure and the query returns almost instantaneously.  I pull the ship to name
    in and the query stall and never finishes.  The Customer dim has 80k records, but only 3000 or so with results for invoices. 
    thanks

    I would delete and re-add the relationships on the Dimension Usage tab, the reprocess everything FULL first dimensions then Cube.  What you are seeing is pretty weird, so I'd want to make sure it's nothing nebulous..
    Then I would look at profiler and see what the heck it is doing that is taking so long.  Sorry I don't have an exactly answer, at this point I would need to poke around and get some more information/ideas.
    Just to be clear, you are using SSAS multidimensional?
    -Ken

  • A view, function and TO_DATE causing an error.

    I have the following statement which calls a view, VW_DIST_RPT_WORK_LIST which in turn calls a function which returns either 'Null' or a date string e.g. '07 Oct 2003' as a VARCHAR2 (alias PROJECTED_DELIVERY_DATE).
    Statement:
    SELECT CUSTOMER_NAME, PROTOCOL_REFERENCE, SHIPPING_REFERENCE, CUSTOMER_REFERENCE, COUNTRY, PROJECTED_DELIVERY_DATE, STATUS, NOTES,
    TO_DATE(PROJECTED_DELIVERY_DATE)
    FROM VW_DIST_RPT_WORK_LIST
    WHERE EXPECTED_DESP_DT IS NOT NULL
    AND UPPER(PROJECTED_DELIVERY_DATE) NOT LIKE('NULL%')
    AND EXPECTED_DESP_DT <= TO_DATE('07/10/2003', 'DD/MM/YYYY')
    AND TO_DATE(PROJECTED_DELIVERY_DATE) <= TO_DATE('31/12/2003', 'DD/MM/YYYY') --< Problem here
    I need to be able to specify a date filter on the PROJECTED_DELIVERY_DATE field and hence used the TO_DATE(PROJECTED_DELIVERY_DATE) <= TO_DATE('31/12/2003', 'DD/MM/YYYY') but this is generating an ORA-01858: a non-numeric character was found where a numeric character was expected.
    I think the problem lies with the fact that this field can contain 'Null' which cannot be converted to a date using TO_DATE. I've tried adding a NOT LIKE ('NULL%') statement to catch any nulls which may be creeping in bu this doesn't solve the problem.
    I've added TO_DATE(PROJECTED_DELIVERY_DATE) to the select above to determine if the nulls are being caught and if the TO_DATE in performing the conversion correctly which it is on both counts.
    Any ideas anyone ?

    The answer provided above by Monika will work for this situation. However, you should seriously think whether you should be using a string for date datatype. Ideally, you should rewrite the function that returns PROJECTED_DELIVERY_DATE and change the return type to DATE. The least you should do is to return NULL (instead of the string 'NULL') from the function. Oracle handles nulls perfectly, there is no reason you should write code to handle nulls;
    One more thing. Looking at the type of error you are receiving, it seems that you are using rule based optimizer. Why do I think so? Because, in rule based optimizer, the conditions are evaluated in a specific order (viz, bottoms-up for AND clauses). To show this, look at the following simple demonstration. I did this in Oracle 8.1.6 (also in 9.2.0.4.0 on Windows).
    -- Check the database version
    select * from v$version;
    BANNER
    Oracle8i Enterprise Edition Release 8.1.6.1.0 - Production
    PL/SQL Release 8.1.6.1.0 - Production
    CORE 8.1.6.0.0 Production
    TNS for Solaris: Version 8.1.6.0.0 - Production
    NLSRTL Version 3.4.0.0.0 - Production
    -- Create the test table
    create table test (a number(2));
    insert into test(a) values (0);
    insert into test(a) values (1);
    insert into test(a) values (2);
    insert into test(a) values (3);
    insert into test(a) values (4);
    insert into test(a) values (5);
    insert into test(a) values (6);
    insert into test(a) values (7);
    commit;
    -- See that I have not analyzed the table. This will make use of RULE based optimizer
    select * from test
    where a > 0
    and 1/a < .25;
    and 1/a < .25
    ERROR at line 3:
    ORA-01476: divisor is equal to zero
    -- Look at the query clause. Even though I specifically asked for records where a is positive
    -- the evaluation path of rule based optimizer started at the bottom and as it evaluated the
    -- first row with a=0, and caused an error.
    -- Now look at the query below. I just re-arranged the conditions so that a > 0 is evaluated
    -- first. As a result, the row with a=0 is ignored and the query executes without any problem.
    select * from test
    where 1/a < .25
    and a > 0;
    A
    5
    6
    7
    -- Now I analyze the table to create statistics. This will make the query use the
    -- cost based optimizer (since optimizer goal is set to CHOOSE)
    analyze table test compute statistics;
    Table analyzed.
    -- Now I issue the erring query. See it executes without any problem. This indicates that
    -- the cost based optimizer was intelligent enough to evaluate the proper path instead of
    -- looking only at the syntax.
    select * from test
    where a > 0
    and 1/a < .25;
    A
    5
    6
    7
    Does the above example seem familiar to your case? Even though you had the AND UPPER(PROJECTED_DELIVERY_DATE) NOT LIKE('NULL%') in your query, a record with PROJECTED_DELIVERY_DATE = 'NULL' was evaluated first and that caused the error.
    Summary
    1. Use dates for dates and strings for strings
    2. Use cost based optimizer
    Thanks
    Suman

  • SQL query returning error in 1 db and not in other db

    database1
    Select AMT_OFF,
    COMMENT_TXT,
    COOP_AMT_OFF,
    DEAL_NO,
    DETAIL_ID,
    DETAIL_TYPE,
    MAX_QTY,
    MIN_QTY,
    PACK_QTY,
    PACK_TYPE,
    PCT_OFF,
    SEQ_NO,
    SITE_NO,
    VENDOR_ITEM
    From dealdtl
    WHERE (deal_no, site_no, seq_no) IN
    (select deal_no, site_no, seq_no
    from deal_sku
    where sku_no = 29747
    and apply_site_no = 1201
    and deal_no = dealdtl.deal_no
    and site_no = dealdtl.site_no
    and seq_no = dealdtl.seq_no)
    and min_qty <= decode(pack_type, 'P',1,'U',10)
    and (site_no, deal_no) IN
    (select site_no, deal_no
    from dealhdr
    where vendor_id = 'VNMIKE'
    --and site_no = dealdtl.site_no
    --and deal_no = dealdtl.deal_no 
    and start_dt <= to_date('12-SEP-08', tmxgbl.date_format)
    and stop_dt >= to_date('12-SEP-08', tmxgbl.date_format)
    query produces an error on to_date function ORA-01858 non numeric character found where numeric expected
    all the tables have no data in them
    i.e. if i do a
    select site_no, deal_no
    from dealhdr --0 rows
    select deal_no, site_no, seq_no
    from deal_sku--0 rows
    Select AMT_OFF,
    COMMENT_TXT,
    COOP_AMT_OFF,
    DEAL_NO,
    DETAIL_ID,
    DETAIL_TYPE,
    MAX_QTY,
    MIN_QTY,
    PACK_QTY,
    PACK_TYPE,
    PCT_OFF,
    SEQ_NO,
    SITE_NO,
    VENDOR_ITEM
    From dealdtl--o rows
    However, when the same query is executed in a different database, it does not bring up an error, same data condition 0 rows on all three tables.
    On both databases tmxgbl.date_format returns the same 'mm/dd/rr' formaty mask
    can somebody explain the reason for this please?
    Thanks
    Vijay

    still no error on the database that doesn not throw an error
    Select AMT_OFF,
    COMMENT_TXT,
    COOP_AMT_OFF,
    DEAL_NO,
    DETAIL_ID,
    DETAIL_TYPE,
    MAX_QTY,
    MIN_QTY,
    PACK_QTY,
    PACK_TYPE,
    PCT_OFF,
    SEQ_NO,
    SITE_NO,
    VENDOR_ITEM
    From dealdtl
    WHERE (deal_no, site_no, seq_no) IN
    (select deal_no, site_no, seq_no
    from deal_sku
    where sku_no = 29747
    and apply_site_no = 1201
    and deal_no = dealdtl.deal_no
    and site_no = dealdtl.site_no
    and seq_no = dealdtl.seq_no)
    and min_qty <= decode(pack_type, 'P',1,'U',10)
    and (site_no, deal_no) IN
    (select site_no, deal_no
    from dealhdr
    where vendor_id = 'VNMIKE'
    --and site_no = dealdtl.site_no
    --and deal_no = dealdtl.deal_no 
    and start_dt <= to_date('09/12/08', chr(39)||tmxgbl.date_format||chr(39))
    and stop_dt >= to_date('09/12/08', chr(39)||tmxgbl.date_format||chr(39))
    --and start_dt <= to_date('12-SEP-08', 'CRAP')
    --no error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • APEX,PDF's, BI Publisher and SQL Query returning SQL code..

    I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
    I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
    Here is my dilemma:
    I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
    The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
    I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
    An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
    Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
    Thank you,
    Tony Miller
    UTMB/EHN
    Title adjusted to allow people to know what I am talking about...
    Message was edited by:
    Tony Miller

    Tony,
    You can find the log as follows:
    - go to http://[yourserver]:[yourport]/em
    - logon to OC4J EM: oc4jadmin/[yourpassword]
    - click on "logs" at the bottom of the page
    - in the hgrid/tree, expand OC4J->home->Application
    xmlpserver
    - click on view log icon
    You can also observe what's going on in BI Publisher
    by going to the command prompt from where you started
    it.
    Or, as a third option, you can locate the file on
    your file system, depending on your setup, the path
    would be something similar to this:
    \oracle\product\10.2.0\bip\j2ee\home\application-deplo
    yments\xmlpserver\application.log
    With that said though, I don't expect you'll find
    much in there that would help with your particular
    problem. I suspect you either get no rows in your XML
    at runtime, due to some session state issues, or your
    XML structure does in fact not match your RTF
    template.
    I'm not quite following your problem description,
    i.e. when did you do what and are you associating
    your report layout with a report query or report
    region. So just some general notes, your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query. If you want to
    use your RTF template with a standard report region,
    you must export the XML file first using the advanced
    XML structure option. And of course the column names
    in your report query need to match the column names
    in your report region.
    Perhaps this helps you further diagnose what's going
    on, if you have additional information that could
    help, let me know. And if you could stage this on
    apex.oracle.com, I'd be happy to take a look.
    Regards,
    MarcMarc,
    Thanks for looking at this issue. Below find my remarks to your questions..
    Re: your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query.At the start of this process, the query code was a function in a package. The function was returning an SQL select statement, for a report region on a page. I took the select statement, built an application query to build a sample of the xml for BI Publisher desktop (Add-on for Word). The code was producing the usual Col01, Col02.. since at design time that is were the column names.
    When I then took the xml from this and built the rtf for loading into my APEX application.
    When testing the Application Query with this RTF report layout, I am getting PDF's. When using it with the report region sending an xml feed to BI Publisher I am getting nothing back.
    I have since taken the sql code and moved it back into the report region, and set the region to have a type of straight SQL Query. I have even tried to hard-code the parameters I was getting from the page to limit data returned.
    Is it possible to see the xml being produced by the APEX page?
    Re: Stage this on apex.oracle.com.. I would love to, but we would have HIPPA issues if I posted the data on a public website.
    Can I send you the RTF file and the xml file that the application query is creating to see if there something weird about them?
    Thank you,
    Tony Miller
    UTMB/EHN

  • Mountain Lion Server: Wiki and Profile Manager return 'Error Reading Settings'

    Hi,
      Have recently installed Mountain Lion Server (clean install) when I open the Server App I am constantly receiving the following error messages on various services inc. Wiki and the Profile Manager Service
    After clicking on various other services that error message evolves into
    Any help would be greatly appreciated.

    Nvm, I managed to resolve this issue to a degree. The errors seem to occur if I copied and installed the Server.app from a windows network location where I had it stored. However if I downloaded and installed the Server.app from the App store the errors dod not occur.

  • MDX Query Returns Error while Executing this from SSMS through openquery

    Hi I'm getting this kind of Error while executing this ..
    Pls help to get it solve .

    Hi Ashish,
    According to your screenshot, it seems you can create a linked server from a SQL Server to the SSAS server, then use OpenQuery to get Analysis Services database structure, right? In this case, please ensure tha you setting is correctly, here is blog which
    describe how to do it step by step, please refer to the link below to see the details.
    http://dwbi1.wordpress.com/2010/01/01/ssas-dmv-dynamic-management-view/
    http://www.ssas-info.com/VidasMatelisBlog/144_using-ssrs-to-report-ssas-2008-database-structure-using-dmvs#more-144
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Multi-row sub query returns  ORA-00904 :invalid identifier error

    I am creating a report from two tables that I am not joining. I want a single line for every row in table1 that meets a date range. Table2 can contain none or many rows for each recored in table1. I want to get up to two fields from table2.
    I was using a case statement to check if there was data and then an in-line query or subquery. Once again, the idea is to have a single line on the report for each table1 record.
    I get this error with the code below. It seems the nested multi-row subquery can not see the a.cr_mas_cr_no identifier.
    ORA-00904: "a"."cr_mas_cr_no": invalid identifier
    Any help is greatly appreciated,
    Sam
    select
    a.cr_mas_cr_no "CRNO", a.cr_mas_type "TYPE", a.cr_mas_status "CR Status",
    a.cr_mas_date_logged "Logged date", a.CR_REL_REQ_APP_DATE "RTP approved",a.CR_REL_REQ_RTP_DATE "RTP Date",
    a.cr_accepted_date "Complete", a.cr_mas_submitted_by "Requester",
    select doc_user FROM crrm_cr_documents WHERE doc_cr_number =a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'BD' ) "Bus Design",
    (select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TD' ) "Tech Design",
    (select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TE' ) "User acceptance test",
    case
    when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 0
    then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    end
    "RTP #1",
    case
    when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 1
    then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 2)
    end
    "RTP #2",
    a.CR_REL_REQ_RTP_BY "Released by",
    a.CR_ACCEPTED_BY "Post RTP User Acceptance",
    a.cr_mas_title "Title", a.cr_mas_id "ID"
    from
    crrm_crmaster a
    where
    (a.CR_REL_REQ_RTP_DATE >= :P1109_BEGDATE and (a.CR_REL_REQ_RTP_DATE <= :P1109_ENDDATE) and
    (a.cr_mas_status = 'Complete' or (a.cr_mas_status = 'Release Approved'and a.CR_REL_REQ_APP_DATE < :P1109_ENDDATE))
    Message was edited by:
    slavanaway

    Iceman,
    Thanks for the reply I will try your suggestion.
    I will try and explain why I think two subqueries (an in-line query with a subquery?) are required. I will use the creation of the column RTP #1 as the example as the RTP #2 column is only different in the rownum selected.
    Looking only at the lines that fail, here is my analysis. (If I rem out the two case lines the query runs, I just don't get two columns of data I need.) I will only examine the first case as the second is changed to extract the second approval via the rownum = 2 criteria. The first statement checks there is at least one RTP approval stored for the request and then gets the user who approved the request if the test is true.
    case when
    (select count(appr_user) from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') > 0
    then
    The above part works fine and the correct count of approvals is returned.
    (select appr_user from (select * from crrm_cr_approvals where appr_cr_no=a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    end
    "RTP #1",
    I moved the parenthesis to the correct location. There can be multiple approvals for a given parent record. Some parent records need one, some need two approvals. If I replace
    (select appr_user from (select * from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    with
    (select appr_user from approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP' and rownum = 1)
    The correct result is returned because it returns exactly one row as rownum=1 limits the query. When rownum = 2 then the query returns null as the rownum never gets to two as the rownum column is built via the set created by the second subquery.
    The subquery builds a set of approvals for a specific "cr_no" and appr_type of "RTP". the outer query then looks at the rownum of the second query
    Here is where I got the rownum information from;
    http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
    So here is what I think is happening;
    1. Main query From and Where are processed. This should provide the "set" for the query
    2.The from subqueries for RTP #1 and RTP #2 should be able to access the a.cr_mas_cr_no field and build a set from the approvals table.
    3.The RTP #1/2 subquery (inline maybe a better description?) would then get the correct row from the from subquery.
    The error "invalid identifier" refers to the a.cr_mas_cr_no field. I assume it means it can not resolve the table alias inside the subquery.
    So maybe your grouping would help, I will try.
    Sam

  • APEX, BI Publisher and SQL Query (PL/SQL Function returning SQL Query)..

    I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
    I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
    Here is my dilemma:
    I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
    The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
    I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
    An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
    Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
    Thank you,
    Tony Miller
    UTMB/EHN
    Title changed, maybe SOMEONE has an idea on this??
    Message was edited by:
    Tony Miller

    Hi,
    1/ first check you are passing the bind variables and
    appropriate values in the call to your report - if
    the query returns no data then you get an empty page
    So if your query takes :P10_USERNAME variable then
    pass it to the report in the URL
    f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=YOUR_REP_QUERY_N
    AME:::P10_USERNAME:MYUSER
    2/ try to use the Default layout first to check your
    report query really returns the data when called
    3/ if you defined a header in your rtf template check
    there is no & (ampersand) - if using & in the header
    and preview the template from word it displays data
    OK, but if you use this template in the report query
    it fails to render the data (bug in Apex-> Bi
    Publisher integration maybe?)
    4/ If using the table in the rtf template check its
    width does not overflow the page margins - there is a
    problem with pdf export
    5/ check
    /oc4j/j2ee/home/application-deployments/xmlpserver/app
    lication.log forthe information on BI Publisher runs
    RadoIssue was in the APEX page having issues.. I recoded a new page and am able to generate BI Publisher based PDF files..
    Thank you,
    Tony Miller
    UTMB/EHN

  • SQL-Query with JDBC returns error ORA-00600

    Hi,
    I try to execute a SQL-Query using JDeveloper 3.2.3 and the Oracle JDBC-Library 8.1.7
    The following statement
    'ResultSet rset=stmt.executeQuery(SQL-String);'
    where stmt is Statement returns a Database-Error
    ORA-00600 with the Arguments [ttcgcshnd-1], [0] [], [], [], [], [], []
    when the SQL-String queries Varchar2 or CHAR-Columns.
    The Query returns correct values for numeric fields.
    The Database-Server is running on Oracle 9i
    Does anybody know, what could be the reason?
    Thanks, Harold

    I found many forums about it also, but I still haven't got solution yet.
    They talk about the cause, and report to oracle group and so on,
    but I still don't know how to solve my problem and how to enable my oracle 9i jdbc driver working.
    Need help please

  • Error "The Query Returned no Objects" while exporting Universe in UDT?

    Hi,
    I have created a Universe on top of BEx Query using UDT in SAP BO 4.1 and tried to Export the Universe to Repository the following error is appearing.
    "The Query Returned no Objects" so "The Universe couldn't be exported".
    Could you please suggest me what could be the issue and how to resolve this.
    Thanks & Regards,
    Ramana,
    +91 8008665199.

    What version of Oracle 9i are you using? Do you have a standard 'NLS_LANG' environment variable set on client's machines? Or do you set it to different values on different machines?
    Here is one of way you could get around it.
    Could you specify the export parameter 'STATISTICS=NONE' while exporting the table data?
    Try this and see.
    If this is successful, you could use the import utility as usual. You could always compute or estimate statistics on the table after import.

  • Errors with querying a query table using non-QoQ query and QoQ query

    HELP ! ! !  Going into testing soon. I need this to work to get correct report results ! ! ! !
    My issue seems similar to the one just answered about Query of Queries RunTime Error
    and the reply from lawhite01 caught my eye.
    This is a 2 parter. The second part is the QoQ part, but the 1st part has a line in the query that is similar to the QoQ one and it uses the same data. Part 1 also throws an error.
    PART # 1.
    I'm trying to use a query table created through QueryNew and then query it.
    I need multiple columns in the query table I create:
    <cfscript>
            tot_AllCurrentDraftListing = QueryNew("AnnounceNum, JP_PDLoc, JP_JS_Title, JP_JS, JP_KW_1, JP_JobTitle, JP_Open, JP_Close, JP_CloseType, JP_CloseName, JP_PosNeed, JP_DirectHire, JP_Desc, JP_Draft, JP_Archived, JP_State, JP_AreaName, JP_AreaID, JP_AreaAlias, JP_Fac_SU, JP_Fac_Facility, JP_FAC_ID, JP_Grade1, JP_sal_low1, JP_sal_high1, JP_Grade2, JP_sal_low2, JP_sal_high2, JP_Grade3, JP_sal_low3, JP_sal_high3, JP_Grade4, JP_sal_low4, JP_sal_high4, JP_Grade5, JP_sal_low5, JP_sal_high5, JP_Posted, JP_TypeHire, JP_HRemail");
        </cfscript>
    Then I populate all the cells of the query table.
    Then I set up to use the created query table.
    I do this first:
        <cfquery name="qAltPostID" datasource="#at_datasource#">
             SELECT AltPoster, fk_Job_AnnounceNum
             from JOB_JPContacts
             Where AltJPContactType = 'AltPosterID'
             and AltPoster = '#session.IHSUID#'
             </cfquery>
    Then, in my first query using the created query, I expect to need to choose from multiple values, so I'm using this line in the query (this is NOT a QoQ query):
                and AnnounceNum IN (<cfqueryparam cfsqltype="CF_SQL_varchar" value="#ValueList(qAltPostID.fk_Job_AnnounceNum)#">)
    I've also tried:
                   and AnnounceNum IN (#ValueList(qAltPostID.fk_Job_AnnounceNum)#)   
    and:
                   and JOB_AnnounceNum IN
                    SELECT fk_Job_AnnounceNum
                    from JOB_JPContacts
                    Where AltJPContactType = 'AltPosterID'
                    and AltPoster = '#session.IHSUID#'
    ERROR is: one record should return. I get 0.
    PART # 2: Here's the QoQ part.
    I get the error:
    Query Of Queries runtime error.
    Comparison exception while executing IN.
    Unsupported Type Comparison Exception: The IN operator does not support comparison between the following types:
    Left hand side expression type = "LONG".
    Right hand side expression type = "STRING".
    A tutorial I found gave an example using only one column for this part of the fix:
         tot_AllCurrentDraftListing = QueryNew("AnnounceNum", "CF_SQL_VARCHAR")
    How would I set up the query with the datatype when I'm using multiple columns:
    <cfscript>
            tot_AllCurrentDraftListing = QueryNew("AnnounceNum, JP_PDLoc, JP_JS_Title, JP_JS, JP_KW_1, JP_JobTitle, JP_Open, JP_Close, JP_CloseType, JP_CloseName, JP_PosNeed, JP_DirectHire, JP_Desc, JP_Draft, JP_Archived, JP_State, JP_AreaName, JP_AreaID, JP_AreaAlias, JP_Fac_SU, JP_Fac_Facility, JP_FAC_ID, JP_Grade1, JP_sal_low1, JP_sal_high1, JP_Grade2, JP_sal_low2, JP_sal_high2, JP_Grade3, JP_sal_low3, JP_sal_high3, JP_Grade4, JP_sal_low4, JP_sal_high4, JP_Grade5, JP_sal_low5, JP_sal_high5, JP_Posted, JP_TypeHire, JP_HRemail");
        </cfscript>
    I used this code after all the cells contained values and before running my QoQ query:
            <cfloop index="intID" from="1" to="#tot_AllCurrentDraftListing.recordcount#" step="1">
                <cfset tot_AllCurrentDraftListing["AnnounceNum"] [intID] = JavaCast("string", intID) />
            </cfloop>
              Is that correct?
    Thanks.
    Whoever can help me with this should be awarded extra points ! ! ! !

                and AnnounceNum IN (<cfqueryparam cfsqltype="CF_SQL_varchar" value="#ValueList(qAltPostID.fk_Job_AnnounceNum)#">)
    If you're passing a list as a param, you need to tell <cfqueryparam> it's a list.  Read:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_p-q_18.html#1102474
    ERROR is: one record should return. I get 0.
    It's a bit hard to comment on this sort of thing without knowing the data involved.
    A tutorial I found gave an example using only one column for this part of the fix:     tot_AllCurrentDraftListing = QueryNew("AnnounceNum", "CF_SQL_VARCHAR")
    How would I set up the query with the datatype when I'm using multiple columns:
    Again, this is a matter of reading the relevant docs:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_m-r_19.html#292759
    As a general rule, if you're having trouble with the syntax of a CFML statement, look it up in the docs.
    Adam

  • Report Script returns no data and "java.io.FileNotFoundException" error

    When attempting to write to a new file (Eg: C:\TEST.txt), Report Script returns no data and "java.io.FileNotFoundException" error occurs.
    This error occurs only in Essbase 9.3.1.3 release, however it works fine in release 9.3.1.0.
    After running the report the script, it pops up the follwing message:
    "java.io.FileNotFoundException: ..\temp\eas17109.tmp (The system cannot find the file specified): C:\TEST.txt"
    When checked the TEST.txt, it was empty.

    Sorry folks, I just found out the reason. Its because there was no data in the combination what I was extracting.
    but is this the right error message for that? It should have atleast create a blank file right?

  • CF Set form.variable for query and Next/Previous pages error

    I have a CF form with a select that posts to a CF "action" page.
    On the action page I: CFSET ItemNumber=#form.ItemNumber#
    I CFOUTPUT the 'ItemNumber' into the CFQUERY (which is an Inner Join dependant on the '#ItemNumber#')...
    All of the above works just fine and displays the database fields in color alternating rows, per the rest of the code.
    Here's the problem:
    I'm displaying 40 rows on a page per "Next and Previous" code. (CFPARAM name="start" default="1" and CFPARAM name="disp" default="40" along with the rest of the NextN code in the header and body). This does display 40 rows on the page and puts a link at the bottom of the page "Next 40 Rows", etc.
    Note: I'm only querying the database once and using the query (query name="data") to populate the table rows And the NextN code (CFOUTPUT name="data") And (CFIF start + disp GREATER THAN data.RecordCount, etc)...
    The problem happens when you click the "Next 40 Rows" link to display the 2nd page of rows. Since (I'm assuming) this NextN code is 're-reading' the same page from top to bottom, an error is thrown when the code tries to read the CFSET ItemNumber=#form.ItemNumber# at the top of the page.
    With the #form.ItemNumber# on this action page Originally coming from the previous posting of the form to this action page, when the "Next 40 Rows" link is clicked and the NextN code re-reads this action page - the CFSET ItemNumber (#form.ItemNumber) is not getting populated and throws the error...
    I hope I've not made this sound confusing.
    I can get the NextN code to work when I'm just querying the database without "flying in" a form variable. But when I CFSET a variable (#form.ItemNumber#) that is inserted into the query, the second page of the NextN throws an error and doesn't display.
    I would include the page code here but it would be fairly lengthy and, as well, the NextN code is a 'standard' CF code -- I've narrowed the problem down to the above "Element is undefined" (when the page tries to reload from the "Next 40 Rows" link) and am hoping there's a simple fix or another way to display the records in Next and Previous pages.
    Thanks to anyone in advance for shedding light on this.
    - e

    Thank you for the reply, Owain.
    Yes - The Next/Previous at the bottom of the page are hyperlinks.
    <a href="ThisPage.cfm?start=#Evaluate("start + disp")#">
    The following is at the top of the page (and is the variable from the form that I CFOUTPUT in the query):
    <cfparam name="ItemNumberDropdown01" default="">
    <cfset ItemNumber = #form.ItemNumberDropdown01#>
    The error report showed that the "Next Page" hyperlink was reading an undefined variable... although when the "action page" first opens from the form posting to it, it populates the CFSET just fine (per the cfparam and cfset above)... As you mention, the hyperlink clearing the form scope is what causes the error in trying to display the next set of records...
    The form page and the 'action page' are both secure pages with an application page setting the session, etc. Am I at risk in using an URL scope?
    Where would this URL scope be put? (The href is shown above - would the URL scope go in this? - How would this be written?)
    The CFPARAM and CFSET would still exist at the top of the 'action page' and still throw an error wouldn't it or would this be replaced with something else to read the form.variable for this 'first' action page to be displayed?
    Thanks again for the 'education' on this...
    - ed

Maybe you are looking for

  • Error while assigning Operating concer to Controlling Area

    Hi... while I am trying to assign operating concern to controlling area, the system is showing the following error message. Diagnosis Controlling area 7500 and operating concern 7500 have different fiscal year variants (01 and K4). However, for cost

  • Purchase order screen short

    hello, i want to prepare purchase order in smartforms, first time i am doing the same, please let me know step by step and possible kindly send me the screenshort for one example of pur. order to understand the steps. yours truly, sujatha

  • Help needed in interpreting panic log from kernel panic error

    My G4 iBook has started giving me kernel panic errors, often immediately after starting up. I haven't installed any new software or RAM recently. I've done a clean system install (completely clean - not an archive and install) then downloaded the com

  • Safari Crashes When Printing/Saving As PDF

    Not sure when this started, Safari 3.04, Leopard 10.5.2 all software updates applied. I can consistently crash Safari by trying to print a page and then selecting any of the PDF menu options. Here's the Safari crash log: Process: Safari [9610] Path:

  • Any way to install Vista in 10.4 other than Boot Camp?

    Since Boot Camp for Tiger went to the chopping block, is there any way to install Vista on my old-ish iMac? My brother's a gamer....