Query length in apex

Hi,
I have region with (sql report)
but this query is very long ,about (50000) character.
and I can not add all the code in the source of the report, because there is limit to length of the code.
Is there any way to solve this problem.
thanks.
Mohd.

thank you for replying
I used the followingcode in the source of the region
declare
str_sql varchar2(4000);
begin
select str1||str4||str3 into str_sql from dual;
return str_sql;
end;
where str1, str3, str4 are functions that generate the query
but
the error I am facing is:
1 error has occurred
Function returning SQL query: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the generic columns checkbox below the region source to proceed without parsing.
(ORA-01489: result of string concatenation is too long)
best regards.
mohd.

Similar Messages

  • SELECT_LIST_FROM_QUERY max query length

    Is there a max query length for SELECT_LIST_FROM_QUERY?
    I have the basis of a list working OK but when I tried to make the query more complex to meet the business requirement I am getting a
    ORA-06550: line 1, column 845: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ;
    I have tried to ensure that I have all the quotes strings working and the like.
    Thanks
    Mark

    Mark,
    How long is your query? The SELECT_LIST_FROM_QUERY function accepts the query as a varchar2, so it’s "limited" to 32767 characters.
    Regards,
    Marc

  • Ora-06502 pl/sql numeric or value error in Report Query in oracle apex

    Hello all,
    I need your help...
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    I am using bi publisher to generate PDF reports in oracle apex.
    We were using APEX 4.0 and migrated to 4.2 just a week ago.
    Now we have apex 4.2.
    When I try to Create report query,
    Shared Components >> Report Queries then create.
    and test a report in a create wizard I am getting a error "ORA-06502: PL/SQL: numeric or value error: character string buffer too small".
    I have also applied a patch "16760897".
    This issue is because of number of columns in a query is more then 26.
    If I run a report with 26 or less number of columns then the is working fine, otherwise getting this error.
    My before migration report queries working perfectly even now, but not new queries.
    This issue is also in apex.oracle.com.
    You can see
    Not working  - http://apex.oracle.com/pls/apex/f?p=619:4
    Working - http://apex.oracle.com/pls/apex/f?p=619:2:
    Please give a solution.
    Thanks you.

    check the DB version compatibility with apex 4 or your DB version to apex 4.0 support for upgrade!
    Oracle Application Express Installation Requirements for 4.0

  • Adhoc query - length of service fields

    Hi all,
    I have question regarding the length of service fields in adhoc query (Actions infotype data fields PNP database).
    When I select these fields I get different results according to reporting period; if i select a keydate then the service is calculated according to this date, but if I select a reporting period, then the service is calculated according to the start date of the reporting period.
    Is this expected behaviour? Please let me know how this can be coded to reference the end date of the reporting period.
    many thanks

    Hi,
    Please check OSS notes 333517 and 357093. Both notes, though from 2000, contain detailed functionality and recommendation around u201Clength of serviceu201D.
    Hope this helps.
    Donnie

  • How to do outer join select query for an APEX report

    Hello everyone,
    I am Ann.
    I have one select statement that calculate the statistics for one month(October 2012 in this example)
    select ph.phase_number
    , sum ( (case
    WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE('Oct 2012','MON YYYY'))
    THEN last_day(TO_DATE('Oct 2012','MON YYYY'))
    ELSE ph.date_finished
    END )
    - ph.date_started + 1) / count(def.def_id) as avg_days
    from phase_membership ph
    inner join court_engagement ce on ph.mpm_eng_id = ce.engagement_id
    inner join defendant def on ce.defendant_id = def.def_id
    where def.active = 1
    and ph.date_started <= last_day(TO_DATE('Oct 2012','MON YYYY'))
    and ph.active = 1
    and UPPER(ce.court_name) LIKE '%'
    group by rollup(phase_number)
    Result is as below
    Phase_Number     AVG_DAYS
    Phase One     8.6666666666666667
    Phase Two     14.6
    Phase Three     12
         11.4615365
    I have other select list mainly list the months between two date value.
    select to_char(which_month, 'MON YYYY') as display_month
    from (
    select add_months(to_date('Aug 2012','MON YYYY'), rownum-1) which_month
    from all_objects
    where
    rownum <= months_between(to_date('Oct 2012','MON YYYY'), add_months(to_date('Aug 2012','MON YYYY'), -1))
    order by which_month )
    Query result is as below
    DISPLAY_MONTH
    AUG 2012
    SEP 2012
    OCT 2012
    Is there any way that I can join these two select statement above to generate a result like:
    Month          Phase Number     Avg days
    Aug 2012     Phase One     8.666
    Sep 2012     Phase One     7.66
    Oct 2012     Phase One     5.66
    Aug 2012     Phase Two     8.666
    Sep 2012     Phase Two     7.66
    Oct 2012     Phase Two     5.66
    Aug 2012     Phase Three     8.666
    Sep 2012     Phase Three     7.66
    Oct 2012     Phase Three     5.66
    Or
    Month          Phase Number     Avg days
    Aug 2012     Phase One     8.666
    Aug 2012     Phase Two     7.66
    Aug 2012     Phase Three     5.66
    Sep 2012     Phase One     8.666
    Sep 2012     Phase Two     7.66
    Sep 2012     Phase Three     5.66
    Oct 2012     Phase One     8.666
    Oct 2012     Phase Two     7.66
    Oct 2012     Phase Three     5.66
    And it can be order by either Phase Number or Month.
    My other colleague suggest I should use an left outer join but after trying so many ways, I am still stuck.
    One of the select I tried is
    select a.display_month,b.* from (
    select to_char(which_month, 'MON YYYY') as display_month
    from (
    select add_months(to_date('Aug 2012','MON YYYY'), rownum-1) which_month
    from all_objects
    where
    rownum <= months_between(to_date('Oct 2012','MON YYYY'), add_months(to_date('Aug 2012','MON YYYY'), -1))
    order by which_month )) a left outer join
    ( select to_char(ph.date_finished,'MON YYYY') as join_month, ph.phase_number
    , sum ( (case
    WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE(a.display_month,'MON YYYY'))
    THEN last_day(TO_DATE(a.display_month,'MON YYYY'))
    ELSE ph.date_finished
    END )
    - ph.date_started + 1) / count(def.def_id) as avg_days
    from phase_membership ph
    inner join court_engagement ce on ph.mpm_eng_id = ce.engagement_id
    inner join defendant def on ce.defendant_id = def.def_id
    where def.active = 1
    and ph.date_started <= last_day(TO_DATE(a.display_month,'MON YYYY'))
    and ph.active = 1
    and UPPER(ce.court_name) LIKE '%'
    group by to_char(ph.date_finished,'MON YYYY') , rollup(phase_number)) b
    on a.display_month = b.join_month
    but then I get an error
    SQL Error: ORA-00904: "A"."DISPLAY_MONTH": invalid identifier
    I need to display a report on APEX with option for people to download at least CSV format.
    I already have 1 inteactive report in the page, so don’t think can add another interactive report without using the iframe trick.
    If any of you have any ideas, please help.
    Thanks a lot.
    Ann

    First of all, a huge thanks for following this Frank.
    I have just started working here, I think the Oracle version is 11g, but not sure.
    To run Oracle APEX version 4, I think they must have at least 10g R2.
    This report is a bit challenging for me.I has never worked with PARTITION before.
    About the select query you suggested, I run , and it seems working fine, but if I try this,
    it return error ORA-01843: not a valid month
    DEFINE startmonth = "Aug 2012";
    DEFINE endmonth   = "Oct 2012";
    WITH     all_months     AS
         select add_months(to_date('&startmonth','MON YYYY'), rownum-1) AS which_month
         ,      add_months(to_date('&startmonth','MON YYYY'), rownum  ) AS next_month
         from all_objects
         where
         rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
    select TO_CHAR (am.which_month, 'Mon YYYY')     AS month
    ,      ph.phase_number
    , sum ( (case
    WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE(am.which_month,'MON YYYY'))
    THEN last_day(TO_DATE(am.which_month,'MON YYYY'))
    ELSE ph.date_finished
    END )
    - ph.date_started + 1) / count(def.def_id) as avg_days
    FROM           all_months          am
    LEFT OUTER JOIN  phase_membership  ph  PARTITION BY (ph.phase_number)
                                        ON  am.which_month <= ph.date_started
                               AND am.next_month  >  ph.date_started
                               AND ph.date_started <= last_day(TO_DATE(am.which_month,'MON YYYY'))  -- May not be needed
                               AND ph.active = 1
    LEFT OUTER join  court_engagement  ce  on  ph.mpm_eng_id = ce.engagement_id
                                        and ce.court_name IS NOT NULL  -- or something involving LIKE
    LEFT OUTER join  defendant         def on  ce.defendant_id = def.def_id
                                        AND def.active = 1
    group by rollup(phase_number, am.which_month)
    ORDER BY  am.which_month
    ,            ph.phase_number
    ;Here is the shorted versions of the three tables:
    A_DEFENDANT, A_ENGAGEMENT, A_PHASE_MEMBERSHIP
    CREATE TABLE "A_DEFENDANT"
        "DEF_ID"     NUMBER NOT NULL ENABLE,
        "FIRST_NAME" VARCHAR2(50 BYTE),
        "SURNAME"    VARCHAR2(20 BYTE) NOT NULL ENABLE,
        "DOB" DATE NOT NULL ENABLE,
        "ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
        CONSTRAINT "A_DEFENDANT_PK" PRIMARY KEY ("DEF_ID"))
    Sample Data
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (101,'Joe','Bloggs',to_date('12/12/99','DD/MM/RR'),1);
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (102,'John','Smith',to_date('20/05/00','DD/MM/RR'),1);
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (103,'Jane','Black',to_date('15/02/98','DD/MM/RR'),1);
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (104,'Minnie','Mouse',to_date('13/12/88','DD/MM/RR'),0);
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (105,'Daisy','Duck',to_date('05/08/00','DD/MM/RR'),1);
    CREATE TABLE "A_ENGAGEMENT"
        "ENGAGEMENT_ID" NUMBER NOT NULL ENABLE,
        "COURT_NAME"    VARCHAR2(50 BYTE) NOT NULL ENABLE,
        "DATE_REFERRED" DATE,
        "DETERMINATION_HEARING_DATE" DATE,
        "DATE_JOINED_COURT" DATE,
        "DATE_TREATMENT_STARTED" DATE,
        "DATE_TERMINATED" DATE,
        "TERMINATION_TYPE" VARCHAR2(50 BYTE),
        "ACTIVE"           NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
        "DEFENDANT_ID"     NUMBER,
        CONSTRAINT "A_ENGAGEMENT_PK" PRIMARY KEY ("ENGAGEMENT_ID"))
    Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (1,'AA',to_date('12/08/12','DD/MM/RR'),null,to_date('12/08/12','DD/MM/RR'),null,null,null,1,101);
    Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (2,'BB',to_date('01/09/12','DD/MM/RR'),null,to_date('02/09/12','DD/MM/RR'),null,null,null,1,102);
    Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (3,'AA',to_date('02/09/12','DD/MM/RR'),null,to_date('15/09/12','DD/MM/RR'),null,null,null,1,103);
    Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (4,'BB',to_date('01/10/12','DD/MM/RR'),null,to_date('02/10/12','DD/MM/RR'),null,null,null,1,105);
    CREATE TABLE "A_PHASE_MEMBERSHIP"
        "MPM_ID"       NUMBER NOT NULL ENABLE,
        "MPM_ENG_ID"   NUMBER NOT NULL ENABLE,
        "PHASE_NUMBER" VARCHAR2(50 BYTE),
        "DATE_STARTED" DATE NOT NULL ENABLE,
        "DATE_FINISHED" DATE,
        "NOTES"  VARCHAR2(2000 BYTE),
        "ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
        CONSTRAINT "A_PHASE_MEMBERSHIP_PK" PRIMARY KEY ("MPM_ID"))
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (1,1,'PHASE ONE',to_date('15/09/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (2,1,'PHASE TWO',to_date('21/09/12','DD/MM/RR'),to_date('29/09/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (3,2,'PHASE ONE',to_date('12/09/12','DD/MM/RR'),null,null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (4,3,'PHASE ONE',to_date('20/09/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (5,3,'PHASE TWO',to_date('02/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (6,4,'PHASE ONE',to_date('03/10/12','DD/MM/RR'),to_date('10/10/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (7,3,'PHASE THREE',to_date('17/10/12','DD/MM/RR'),null,null,0);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (8,1,'PHASE THREE',to_date('30/09/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),null,1);
    The requirements are:
    The user must be able to request the extract for one or more calendar months, e.g.
    May 2013
    May 2013 – Sep 2013.
    The file must contain a separate row for each calendar month in the requested range. Each row must contain the statistics computed for that calendar month.
    The file must also include a row of totals.
    The user must be able to request the extract for either Waitakere or Auckland or Consolidated (both courts’ statistics accumulated).
    Then the part that I am stuck is
    For each monitoring phase:
    Phase name (e.g. “Phase One”)
    Avg_time_in_phase_all_particip
    for each phase name,
    Add up days in each “phase name” Monitoring Phase, calculated as:
    If Monitoring Phase.Date Finished is NULL or > month end date,
    +(*Month end date* Minus Monitoring Phase.Date Started Plus 1)+
    Otherwise (phase is complete)
    +(Monitoring Phase.Date Finished Minus Monitoring Phase.Date Started Plus 1.)+
    Divide by the numbers of all participants who have engaged in “phase name”.
    This is the words of the Business Analyst,
    I try to do as required but still struggle to identify end_month for the above formula to display for the range of months.
    Of course, I can write two nested cursor. The first one run the list of month, then for each month, run the parameterised report.
    But I prefer if possible just use SQL statements, or at least a PL/SQL but return a query.
    With this way, I can create an APEX report, and use their CSV Extract function.
    Yes, you are right, court_name is one of the selection parameters.
    And the statistics is not exactly for one month. It is kind of trying to identify all phases that are running through the specified month (even phase.date_started is before the month start).
    This is the reason why I put the condition AND ph.date_started <= last_day(TO_DATE('Oct 2012','MON YYYY')) (otherwise I get negative avg_days)
    User can choose either one court "AA" or "BB" or combined which is all figures.
    Sorry for bombarding you a lot of information.
    Thanks a lot, again.
    Edited by: Ann586341 on Oct 29, 2012 9:57 PM
    Edited by: Ann586341 on Oct 29, 2012 9:59 PM

  • Query performance in Apex

    I can't find an explanation for the issue I have. I have a query that takes less then a second in TOAD and almost a minute in Apex. I isolated the problem in the where clause where I have :
    and rp.process_dt between to_date(:P76_BEGIN_DATE, 'mm/dd/yyyy') and to_date(:P76_END_DATE, 'mm/dd/yyyy')
    if I remove this from the where clause the query takes less than a sec. (In TOAD it doesn't matter whether this condition is present or not it always takes about 500msec.)
    In Apex - if instead of the line above I have hard coded values for the date fields :
    and rp.process_dt between to_date('05/15/2008', 'mm/dd/yyyy') and to_date('05/15/2009', 'mm/dd/yyyy')
    the time is what is suppose to be about 500msec.
    Any ideas what is going on and how to fix it?

    Hi
    It's normally something like...
    select
    ROWID as apxws_row_pk,...columns
    count(*) over () as apxws_row_cnt
    from (
    select * from -- any predicates --(
    select * from my_table
    where ....
    ) r
    ) r where rownum <= to_number(:APXWS_MAX_ROW_CNT) So where is it coming back in a second from? If it's sql developer then the default fetch is fifty, so not a meaningful comparison, change the array fetch to the same as you max row count in the report attributes and you may have something more meaningful - and again read tom kytes bit on rownum/paqgination to see how it actually works.
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    Don't forget to mark replies helpful or correct ;)

  • Query Hangs in Apex but runs quickly in SQL

    Hi,
    I'm using Apex version 4.1.
    I have an interactive report that just hangs when I run it, but the query runs in about 19 seconds in AquaData when I hard-code my bind variables. The bind variables are a start and end date, and they are used twice to pull a date range from two different fields. I'm wondering if the bad performance has something to do with that? I have to call the start and end date twice in my query. Even when I try Debug or SQL Commands in Apex it just hangs.
    Any ideas on how to improve this?
    Thanks for your help.

    Greg,
    You wrote: but the query runs in about 19 seconds in AquaData when I hard-code my bind variables.Do those same hard-coded bind variables not execute in SQL Commands ?
    Here is your code formatted so others may see something that I am not seeing: Then again; where does the alias qce come from?
    SELECT     f.fac_id AS "Office ID",
               f.fac_name AS "Office Name",
               SUM(CASE
                      WHEN ADD_MONTHS ( pt.date_posted, - ( 12 * 18 ) ) >=
                              p.date_of_birth
                      THEN
                         1
                      ELSE
                         0
                   END)
                  AS "Adult Pat Count",
               ROUND (
                       NVL (
                             SUM(CASE
                                    WHEN ADD_MONTHS ( pt.date_posted,
                                                      - ( 12 * 18 ) ) >=
                                            p.date_of_birth
                                    THEN
                                       1
                                    ELSE
                                       0
                                 END)
                             / COUNT ( * ),
                             0
                       2
               * 100
                  AS "Adult Pat %",
               SUM(CASE
                      WHEN ADD_MONTHS ( pt.date_posted, - ( 12 * 18 ) ) <=
                              p.date_of_birth
                      THEN
                         1
                      ELSE
                         0
                   END)
                  AS "Pedo Pat Count",
               ROUND (
                       SUM(CASE
                              WHEN ADD_MONTHS ( pt.date_posted, - ( 12 * 18 ) ) <=
                                      p.date_of_birth
                              THEN
                                 1
                              ELSE
                                 0
                           END)
                       / COUNT ( * ),
                       2
               * 100
                  AS "Pedo Pat %",
               SUM(CASE
                      WHEN ADD_MONTHS ( pt.date_posted, - ( 12 * 18 ) ) >=
                              p.date_of_birth
                      THEN
                         pt.amount_tot
                      ELSE
                         0
                   END)
                  AS "Adult Rev",
               DECODE (
                        SUM ( pt.amount_tot ),
                        0,
                        0,
                        ROUND (
                                NVL (
                                      SUM(CASE
                                             WHEN ADD_MONTHS ( pt.date_posted,
                                                               - ( 12 * 18 ) ) >=
                                                     p.date_of_birth
                                             THEN
                                                pt.amount_tot
                                             ELSE
                                                0
                                          END)
                                      / SUM ( pt.amount_tot ),
                                      0
                                2
               * 100
                  AS "Adult Rev %",
               SUM(CASE
                      WHEN ADD_MONTHS ( pt.date_posted, - ( 12 * 18 ) ) <=
                              p.date_of_birth
                      THEN
                         pt.amount_tot
                      ELSE
                         0
                   END)
                  AS "Pedo Rev",
               DECODE (
                        SUM ( pt.amount_tot ),
                        0,
                        0,
                        ROUND (
                                NVL (
                                      SUM(CASE
                                             WHEN ADD_MONTHS ( pt.date_posted,
                                                               - ( 12 * 18 ) ) <=
                                                     p.date_of_birth
                                             THEN
                                                pt.amount_tot
                                             ELSE
                                                0
                                          END)
                                      / SUM ( pt.amount_tot ),
                                      0
                                2
               * 100
                  AS "Pedo Rev %"
    FROM                   pats p
                        JOIN
                           clinic_ext ce
                        ON p.clinic_id = ce.clinic_id AND p.loc_id = ce.loc_id
                     JOIN
                        pat_trans_rep pt
                     ON     p.clinic_id = pt.clinic_id
                        AND p.unique_id = pt.unique_id
                        AND pt.charge_yn = 'Y'
                  JOIN
                     fac_hier_links fk
                  ON qce.fac_id = fk.fac_id
               JOIN
                  fac f
               ON qce.fac_id = f.fac_id
    WHERE      p.date_of_first_visit BETWEEN TO_DATE ( :p5_start_date,
                                                       'MM/DD/YYYY' )
                                         AND  TO_DATE ( :p5_end_date,
                                                        'MM/DD/YYYY' )
               AND pt.date_posted BETWEEN TO_DATE ( :p5_start_date, 'MM/DD/YYYY' )
                                      AND  TO_DATE ( :p5_end_date, 'MM/DD/YYYY' )
    GROUP BY   f.fac_id, f.fac_nameJeff
    Edited by: jwellsnh on Sep 15, 2011 1:49 PM

  • Max customized query length

    Hi all,
    anyone knows if it's possible to extend the maximum length (it seems to be 210 chars) of the data-block mask for customized query? I mean that mask Forms displays when, in enter-query mode, you use '&' to insert particular query conditions.
    Thanks,
    Marco

    I'm not sure.
    But one option is to build this mechanism on your own. Just popup a window to get the where clause and then use set_block_property(default_where) to attach it to the block.

  • Query Builder on APEX

    Is it possible to write SQL code from within the Query Builder, and if so how do you do that? Thanks!

    Hi,
    I think that depends on what your aim is. If, for example, you wanted to create a SQL View, you could go to Object Browser, click Create (top-right), select View and then click the Query Builder option. Once you've completed the query, you click Return to pass the code back into the Create View page. There are other places within Apex, where Query Builder is available.
    Otherwise, there are packages available such as the free SQL Developer ([http://www.oracle.com/technology/products/database/sql_developer/index.html]) that may be able to help you.
    Andy

  • Query length input-output

    Hi everybody,
    I have two doubts:
    1)     Has oracle a limit to the length of the query? (number of characters)
    2)     Has oracle a limit in the length of the output of a query? (number of characters)
    I ask these things because I have a long query (about 1500 characters) and the output should be formed by 1300 characters per row.
    Are there problem in the output of sqlplus?
    Another question if I wanted the previous output in XML format how can I make? Has oracle something to do this last thing?
    I am using oracle 10g.
    Thanks, bye bye.

    1. Here is the text from the [Oracle Database Limits Reference|http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/limits003.htm#i288032]:
    [http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/limits003.htm#i288032]{code}2. I do not believe Oracle has as limit on the output of the program. I think this is the responsibility of the calling program, in this case SQL*Plus. As far as SQL*Plus limiting characters I believe it can/does depending on data type. I recommend you read the [SQLPlus Users Guide and Reference|http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/toc.htm], specifically, Chapter 6 "Formatting SQL*Plus Reports."
    3. As far as XML, you should read the [XML DB Developers Guide|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/toc.htm], specifically Chapter 3
    I hope this helps!
    Edited by: Centinul on Sep 1, 2008 8:22 AM
    I wish I knew this was a double post before hand.. doh!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SVG Chart Query 'Length'

    Hi,
    I cause the following error to be raised when trying to save (Apply Changes) the query for an SVG chart:
    ORA-20001: set_attribute error: ORA-01461: can bind a LONG value only for insert into a LONG column
    The query just got 'longer' which prompts the question:
    Is there an upper limit to the length (number of characters) of the query ?
    Thanks for all and any help,
    sinclair

    I cannot answer your direct question, but if your SELECT statement is hard-coded and not generated from PL/SQL, I can offer a possible work around. You could create a database VIEW using your SELECT statement and query the view in your SVG chart.
    Mike

  • LDP Query length

    I was wondering if anybody knows if there are limitations on the size of an LDAP query.
    I have an application that is enumerating AD via group membership. Using the query (&(objectclass=group)(CN=Groupname*)) with Attribute of Member only pulls back the DN of the users where the application requires SamAccountName.
    So. I have reversed the query and have searched for users that are memberof:
    (&(objectclass=user)(| (Memberof=CN=Administrators,CN=Builtin,DC=Domain,DC=nonprod)( MemberOf=CN=APP_TH_Admin_DEV,OU=Groups,OU=User Groups,DC=Domain,DC=nonprod)))
    This works in pulling back all members of each group
    However, this statment does not...
    (&(objectclass=user)(| (MemberOf=CN=APP_TH_ContentStudio_DEV,OU=Groups,OU=User Groups,DC=domain,DC=nonprod(MemberOf=CN=APP_TH_Admin_DEV,OU=Groups,OU=User Groups,DC=domain,DC=nonprod)))
    The only thing I can think of is the size of the query?
    Also, if anyone knows a way that you can pull back the SamAccountName from groups that would be even better :)
    Cheers,
    Sean

    Glad to hear. I didn't know what the limit was but I didn't think length was the issue in that query ... take a look the length of some of the queries ADUC lets you create! For example, searching for users where the First Name starts with Mark and Department
    starts with IT, ADUC generated this:
    (&(&(|
    (&(objectCategory=person)(objectSid=*)(!samAccountType:1.2.840.113556.1.4.804:=3))
    (&(objectCategory=person)(!objectSid=*))
    (&(objectCategory=group)(groupType:1.2.840.113556.1.4.804:=14)))
    (objectCategory=user)(objectClass=user)(givenName=Mark*)(department=IT*)
    When it could have been covered by this:
    (&(samAccountType=805306368)(department=IT*)(givenName=Mark*))
    ADUC is still useful for "how do I do this" and "does this work" questions though but maybe clean up the resulting query string a bit if you are going to use it in scripts, it'll make them a lot easier to read. I wouldn't want to type that first query into
    a Get-AD* -Filter!! This site is very useful for this stuff:
    http://www.selfadsi.org/extended-ad/search-user-accounts.htm
    And search this link for "Default Values for LDAP Administrative Limits":
    http://technet.microsoft.com/en-us/library/cc755809%28WS.10%29.aspx#w2k3tr_adsrh_how_lhjt If MaxReceiveBuffer is the limit, you've got 10MB to play with ;) And a potential 256MB for the results!
    Mark

  • Failed to parse SQL Query - External Tables [Apex 4.0.2]

    Greetings experts -
    Has anyone encountered errors when creating a report in Apex that sources from an external table within the database? I'm using the 4.0.2 version that is packaged with the 11g XE edition on 64bit CentOS.
    For example, I might run:
    SELECT NULL LINK,
    COL1 LABEL,
    COL2 VALUE
    FROM MYTAB;
    Where MYTAB is an external table sitting on top of a comma-separated file. When I go to create the page, I'm prompted with the "Failed to parse SQL" dialogue.
    I noticed that if I did CTAS on the external table, and referenced the CTAS table, my page ran without problem!
    Any ideas? Is this a known "limitation" of Apex?
    Thanks,
    CJ

    Chiedu,
    Please try removing all declarative validations on this tabular form, and see if it works as expected then. There are some limitations on the type of views and joins that are supported by tabular forms when using the new declarative validations, i.e. you'll need a key preserved table in your view or join.
    Regards,
    Marc

  • SQL Query Problem using APEX!!

    I want to make a report based on 4 text fields and 2 select lists. I can make the report based on P1_SENDER and P1_RECEIVER but i can´t combine the results all together (P1_SENDER, P1_RECEIVER, P1_DATE, P1_SUBJECT, P1_HOUR1, P1_HOUR2)
    Here´s the query:
    select "EXCHANGE"."DATE_EX" as "DATE_EX",
    "EXCHANGE"."HOUR_EX" as "HOUR_EX",
    "EXCHANGE"."RECEIVER" as "RECEIVER",
    "EXCHANGE"."SENDER" as "SENDER",
    "EXCHANGE"."SUBJECT" as "SUBJECT"
    from "EXCHANGE" "EXCHANGE"
    where "EXCHANGE"."DATE_EX" =(:P1_DATE)
    or "EXCHANGE"."HOUR_EX" BETWEEN (:P1_HOUR1) AND (:P1_HOUR2)
    or "EXCHANGE"."RECEIVER" =(:P1_RECEIVER)
    or "EXCHANGE"."SENDER" =(:P1_SENDER)
    or "EXCHANGE"."SUBJECT" LIKE('%:P1_SUBJECT%')
    The P1_SUBJECT field must allow the user to search for any kind of word and the P1_HOUR1 and the P1_HOUR2 represents an interval of time. Is the syntax right? What am i doing wrong? The results of this query appear all scrambled.

    I think the condition you want on the subject should be written as:
    or "EXCHANGE"."SUBJECT" LIKE '%' || :P1_SUBJECT || '%'

  • Maximum length of query string for functions return a SELECT

    Hi all,
    I have a report that gets it's SELECT statement from a function, instead of being coded into the region. All was well but I suspect now I'm blowing some kind of limit as I'm getting an error :
         ORA-06502: PL/SQL: numeric or value error
         Error      ERR-1101 Unable to process function body returning query.
    However if I run the procedure out of ApEx and grab the SELECT statement then it works fine. The length of the query is 8636 bytes (yup, it's a beauty!).
    Does anyone know if there is a hard limit to the size of the string that can be returned?
    I'm using ApEx 3.1.
    Thanks,
    Steve H

    I do have a similar painfull scenario - Although my query length is very less i.e 618 bytes only.
    I have defined a stored function, which returns an SQL query string, this return SQL string executes fantastic but when I tried to to call this function from a APEX report it gives error. the details are as follows. Please help.......
    The function code:
    CREATE OR REPLACE function PROD."TEST_C_QRY"
    return VARCHAR2
    is
    msql VARCHAR2(32767);
    Begin
    msql:='Select null,statusname,AgeInd, ';
    For m_stat in (select statusname from a02_status)
    loop
    msql:= msql || q'[decode(statusname,']';
    msql:= msql || m_stat.statusname;
    msql:= msql || q'[',count(id),0) ]';
    msql:= msql || m_stat.statusname|| ',';
    end loop;
    msql:=rtrim(msql,',');
    msql:= msql||' from ';
    msql:= msql||'( ';
    msql:= msql||'select a.id, round(sysdate-a.registeredon) TimeSpan,';
    msql:= msql||'case ';
    msql:= msql||q'[when round(sysdate-a.registeredon)<=7 then 'Week' ]';
    msql:= msql||q'[when round(sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' ]';
    msql:= msql||q'[when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then 'Month' ]';
    msql:= msql||q'[else 'More...'  end ageind,]';
    msql:= msql||'a.status_id,b.statusname ';
    msql:= msql||'from a02_task a,a02_status b ';
    msql:= msql||'where b.id=a.status_id) ';
    msql:= msql||'group by statusname,AgeInd;';
    return msql;
    end TEST_C_QRY;
    The Output SQL comes from this is
    SQL> Select null,statusname,AgeInd, decode(statusname,'Scheduled',count(id),0) Scheduled,decode(statusname,'Executing',count(id),0) Executing,decode(statusname,
    'Completed',count(id),0) Completed from ( select a.id, round(sysdate-a.registeredon) TimeSpan, case when round(sysdate-a.registeredon)<=7 then 'Week' when round
    (sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then
    'Month' else 'More...' end ageind, a.status_id,b.statusname from a02_task a,a02_status b where b.id=a.status_id) group by statusname,AgeInd;
    The result that comes when I execute the above resultant SQL is as follows.
    N STATUSNAME AGEIND SCHEDULED EXECUTING COMPLETED
    Completed More... 0 0 4
    Completed Week 0 0 1
    Scheduled Week 1 0 0
    Completed Month 0 0 3
    Executing More... 0 1 0
    Executing Month 0 6 0
    Scheduled More... 1 0 0
    7 rows selected.
    But the surprising error that comes from Oracle XE when I use the following code for stacked bar chart
    Code:
    begin
    return TEST_D_QRY;
    end;
    Error thrown by XE report builder is as follows:
    1 error has occurred
    Failed to parse SQL query!
    Select null,statusname,AgeInd, decode(statusname,'Scheduled',count(id),0) Scheduled,decode(statusname,'Executing',count(id),0) Executing,decode(statusname,'Completed',count(id),0) Completed from ( select a.id, round(sysdate-a.registeredon) TimeSpan, case when round(sysdate-a.registeredon)<=7 then 'Week' when round(sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then 'Month' else 'More...' end ageind, a.status_id,b.statusname from a02_task a,a02_status b where b.id=a.status_id) group by statusname,AgeInd;
    Certain queries can only be executed when running your application, if your query appears syntactically correct, you can save your query without validation (see options below query source).
    Regards,
    Soumen

Maybe you are looking for

  • IBooks bookmarks not working after 1.2 upgrade

    I have noticed the bookmarks on my iPad iBooks are not working after upgrading to 1.2 today. I am unable to bookmark pages when I need to. It only works sporadically. I have also noticed when closing a book and reopening, the book opens at last bookm

  • ALV switch to Excel inplace & return

    Hello. I've developed a program that outputs information in ALV format. From there, I'm able to navigate to Excel inplace and the information is displayed as expected. My Requirement/problem is to make changes in Excel, save them & return to ALV with

  • How many number of lines of code Java File can have?

    Hi ALL Is there any limit on java source file code length? does more code (say more than 4000 line) impact on performace? Is there any recomendation on code length and file size? Thanks

  • Different Image Count between a Project in the Project Panel & Browser

    Howdy, While in Aperture, after selecting several Master images from a Project using the Browser I deleted them to the Finder's Trash (Master & associated Versions) and emptied the Trash. The image count in the Browser updates but not in the Project

  • How to give space to variable after every letter

    hi, i am having variable like this 123445 i have to diplay like 1 2 3  4 4 5, is there si any FM... i dont to want to use offset logic