Conditional display of region with PL/SQL function returning SQL query

Hello,
ApEx 2.0.
I use PL/SQL functions that return SQL queries to display the contents of a region.
How could I conditionally display such region ? If no data is found, the region shouldn't be shown. I tried with "SQL query returns at least one row" but this doesn't seem to work.
Thanks,
Matthias

Hi Matthias,
Are the regions in question report regions? So your PL/SQL process is returning a SQL query and then populating a report?
The EXISTS(SQL Query returns at least one row) condition should work, try running the query you are using in the Expression 1 textarea inside SQL*Plus, or SQL developer using the same parameters, and see what gets returned.
If you are still stuck, can you post the query you are using inside your Expression 1 textarea of the Conditions section and I can take a look at it for you.
Hope this helps,
Cj

Similar Messages

  • Issue with running PL/SQL function returning Sql query

    hi, I am trying to create a report region by using the option of PL/SQL function returning sql query.
    I notice that it's very slow for the report region page to show up. In my PL/SQL function body, there are only 3 steps, first update all the 10 rows of varchar2 fields to null,then insert values to those fields, then select all from the table to show report results. It takes more than 5 minitues for the page to load up, how ever, if i run those steps in SQL*Plus, it only takes a couple of seconds to finish. Any suggestions?
    Thanks,
    gina

    Sergio, the codes are as followed,
    Declare
    q varchar2(32767); -- query
    Begin
    q := 'select "ID",'||
    '"ENTRY NAME","TOTAL","#CM","%CM","#CA",'||
    '"%CA", from Info_table';
    update info_table
    set "TOTAL" = '',
    "#CM" = '',
    "%CM" = '',
    "#CA" ='',
    "%CA"=''
    where "ID"<=10;
    // set all data in column Total to null,there is only 10 rows in the table
    update info_Table set Total = vTotal,
    "#CM" = vCM
    (those variables hold user key-in Text filed value)
    where ID = 1;
    return q;
    End;

  • On Submit process not firing -report (PL/SQL function returning SQL query)

    Can anyone suggest possible causes / solutions for the following problem?
    I have a report region that uses a PL/SQL function returning SQL query. The report allows the user to update multiple fields / rows and then click a button to submit the page which should run the On-Submit process to update the database. However the process does not run and I get a 'HTTP404 page cannot be found' error; and when I navigate back using the Back button I cannot then navigate to any other page in my application without getting the same error. The button was created by a wizard selecting the options to submit the page and redirect to a (same) page. The button does not actually have a redirect in its definition but the wizard created a branch to the same page which should work and the button has the text 'submit as SUBMIT' next to it so it appears to be set up correctly.
    I have recreated this page several times in my application and I cannot get the On-Submit process to run. However I have created a cut down version of the same page in the sample application on apex.oracle.com at http://apex.oracle.com/pls/otn/f?p=4550:1:179951678764332 and this works perfectly so I am at a loss to understand why it does not work in my application. I cannot post any part of the application itself but if anybody would like to check out page 30 of the sample application (Customer Update Test tab) updating the surnames only, using credentials ja, demo, demo this is pretty much what I have got in my application.
    Any ideas would be much appreciated?

    Thanks for the suggestions guys. I have now identified that the problem goes away when I remove the second table from my report query. The original report query retrieved data from two tables and the process was updating only one of the tables. I thought I had approached the task logically i.e. first get the report to display the records from the two tables, then get the process to update the first table and finally to modify the process further to update the second table.
    Can anyone point me to an example of multiple row updates on multiple tables using a PL/SQL function returning an SQL query?

  • Column order in SQL Query (PL/SQL function returning a query)

    Hi,
    when I define a PL/SQL function returning a query inside a region, I often find that the column order is arbitrarily changed.
    How do I enforce the column order ?
    Bye,
    Flavio

    I removed the 11th column called service_name from this dynamic query: and now the report says: report error:
    ORA-01403: no data found. I messed around with the Headiuns Type. It was set to Custom. I changed it to Column Names. There is no difference.
    I am not sure how to fix?
    declare topqry varchar2(32000);
    whereqry varchar2(32000);
    finalqry varchar2(32000);
    var_status varchar2(100);
    division_status varchar2(50);
    office_status varchar2(1000);
    user_status varchar2(1000);
    overdue_status varchar2(1000);
    begin
    if :P10_FALLBACK = 'All' then
    var_status:= ' and vp.status in (''FA'',''FBA'',''FBI'',''25%'',''50%'',''90%'',''Closed'') ';
    elsif :P10_FALLBACK = 'Active' then
    var_status:= ' and vp.status in (''FA'',''25%'',''50%'',''90%'',''FBA'') ';
    elsif :P10_FALLBACK = 'FB' then
    var_status:= ' and vp.status in (''FBA'',''FBI'') ';
    elsif :P10_FALLBACK = 'Closed' then
    var_status:= ' and vp.status in (''Closed'') ';
    elsif :P10_FALLBACK = 'Inactive' then
    var_status:= ' and vp.status in (''FBI'') ';
    end if;
    if :P10_DIVISION = 'All' then
    division_status:= ' and vp.vms_division in (''News'',''Ad Services'') ';
    elsif :P10_DIVISION = 'News' then
    division_status:= ' and vp.vms_division in (''News'') ';
    elsif :P10_DIVISION = 'Ad' then
    division_status:= ' and vp.vms_division in (''Ad Services'') ';
    end if;
    if :P10_OFFICE = '%' then
    office_status:= ' and OFFICE_ID in (select office
    from VMS_OFFICE_ACCESS
    where user_id = lower(:P0_user) ) ';
    else
    office_status:= ' and OFFICE_ID in :P10_OFFICE ';
    end if;
    if :P10_LIMIT_USER = '%' then
    user_status := ' and SALESPERSON in (select first_name || '' '' || last_name
    from VMS_PROSPECT_users u
    join vms_office_access o
    on u.office_id = OFFICE
    where o.user_id = lower(:P0_USER) ) ';
    else
    user_status:= ' and SALESPERSON in (:P10_LIMIT_USER ) ';
    end if;
    if :P10_SHOW_OVERDUE = 'Show' then
    overdue_status:= ' and target_close_date <= sysdate ';
    var_status:= ' and vp.status in (''25%'',''50%'',''90%'',''FBA'') ';
    else
    overdue_status:= ' and FIRST_APPOINTMENT between
    nvl(to_date(:P10_FIRST_APPT_START, ''mm/dd/yyyy''),FIRST_APPOINTMENT) and
    nvl(to_date(:P10_FIRST_APPT_END,''mm/dd/yyyy''),FIRST_APPOINTMENT) ';
    end if;
    topqry := 'SELECT OFFICE_ID ,vp.PROSPECT_ID ,ENTRY_DATE ,ACCOUNT , NEXT_CONTACT_DATE ,ACTION_STEP ,
    TARGET_CLOSE_DATE ,vp.STATUS ,SALESPERSON ,vp.SALES_TYPE ,service_name , FIRST_APPOINTMENT ,MODIFY_DATE ,EST_ANNUAL_REVENUE ,EST_INCREMENTAL_REVENUE ,
    pi.NOTES , pi.SALES_TYPE ,pi.STATUS ,Contact ,Origin_Source FROM VMS_PROSPECTING_ITEMS pi right outer join VMS_PROSPECTS vp on vp.PROSPECT_ID = pi.PROSPECT_ID left outer join VMS_SERVICES vs on vs.service_ID = pi.service_ID where 1 = 1 ';
    whereqry := ' and (not exists (select *
    from VMS_PROSPECTING_ITEMS i3
    where vp.prospect_id = i3.prospect_id)
    or exists (select *
    from VMS_PROSPECTING_ITEMS i2
    where i2.order_id = pi.order_id
    and active = ''Y'' )) and instr(upper(ACCOUNT),upper(nvl(:P10_ACCOUNT,ACCOUNT))) > 0 ';
    whereqry := whereqry || var_status || division_status || office_status || user_status || overdue_status;
    finalqry := topqry || whereqry;
    return finalqry ;
    end;

  • SQL Query(PL/SQL Function Returning SQL Query)

    I am trying to write a dynamic report using SQL Query(PL/SQL Function Returning SQL Query).
    I can get the report to run but I need to concatinate some columns into one, seperated by a comma or a dash.
    I have tried select *****||','||***** alias
    also select *****||'-'||***** alias
    but I always get an error.
    Is there a way of doing this please
    Gus

    This is my full query
    declare
    v_query varchar2(4000);
    begin
    if :P63_TRAN_INFO = 2 THEN
    v_query := 'select
         A.FILENR,
         A.EXERCISENAME,
    A.STARTDATE,
    A.ENDDATE,
         A.UNIT,
    A.ACCADDRESSES, B.ADDRESS, B.ADDRESS_1, B.POST_CODE, B.TOWN,
         A.EXERCISEAREAS,
         A.TOTALVEHICLES,
    A.TOTALTROOPS+A.RNTOTALTROOPS+A.RAFTOTALTROOPS TOTALTROOPS,
    A.CAR, A.MINIBUS, A.HGV,
    A.NAMERANK, A.ADDRESS, A.ADDRESSI, A.ADDRESSII, A.POSTCODE,
    A.TRANSIT,
    A.INFOONLY
    from     BFLOG_AT A, BFLOG_ACCADDRESS B
    WHERE A.ACCADDRESSES = B.NAME
    AND A.STARTDATE >= :P63_START_DATE
    AND A.ENDDATE <= :P63_END_DATE
    AND A.AUTHORISED = 1
    AND A.INFOONLY = 1' ;
    END IF;
    RETURN v_query;
    END;
    This query runs ok, but if I try changing it to the code below with fields concatinated, then it fails
    declare
    v_query varchar2(4000);
    begin
    if :P63_TRAN_INFO = 2 THEN
    v_query := 'select
         A.FILENR,
         A.EXERCISENAME,
    A.STARTDATE,
    A.ENDDATE,
         A.UNIT,
    A.ACCADDRESSES||','||B.ADDRESS||','||B.ADDRESS_1||','||B.POST_CODE||','||B.TOWN ADDRESS,
         A.EXERCISEAREAS,
         A.TOTALVEHICLES,
    A.TOTALTROOPS+A.RNTOTALTROOPS+A.RAFTOTALTROOPS TOTALTROOPS,
    A.CAR, A.MINIBUS, A.HGV,
    A.NAMERANK, A.ADDRESS, A.ADDRESSI, A.ADDRESSII, A.POSTCODE,
    A.TRANSIT,
    A.INFOONLY
    from     BFLOG_AT A, BFLOG_ACCADDRESS B
    WHERE A.ACCADDRESSES = B.NAME
    AND A.STARTDATE >= :P63_START_DATE
    AND A.ENDDATE <= :P63_END_DATE
    --AND (A.EXERCISEAREAS LIKE "GAP, OA, OAL")
    --OR (A.EXERCISEAREAS LIKE "Harz")
    AND A.AUTHORISED = 1
    AND A.INFOONLY = 1' ;
    END IF;
    RETURN v_query;
    END;
    Cheers
    Gus

  • Report- Pl/sql function returning sql query parsing page items as text?

    Hi Team,
    I am facing a strange issue .
    I have four page items namely
    1)JOB_CODE
    2)MIN_EXP
    3) MAX_EXP
    4) SOURCES1
    I have a report of the type "Pl/sql function returning sql query"
    declare
    v_sql varchar2(4000);
    begin
    if (:JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql:= 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:JOB_CODE IS NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:MIN_EXP IS NULL and :JOB_CODE IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years <= :MAX_EXP and V_REQUIREMENT = :JOB_CODE and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:MAX_EXP is null and :JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    end if;
    insert into query_list values (v_sql);
    insert into debug values (:JOB_CODE , :MIN_EXP , :MAX_EXP , :SOURCES1);
    return v_sql;
    end;
    Please not that I am insertin the query into a table called Query_list and the page item values into the table called Debug thru the pl/sql function which returns teh query.
    Now I select the data from the debug tables.
    select unique(query) from query_list;
    select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like '%:SOURCES1%'
    select * from debug;
    JOBCODE     MINEX     MAXEX     SOURCE
    21     1     10     donkeyHire
    And if I run the query in sql I get some records returned
    select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = 21 and v_experience_years >= 1 and v_experience_years <= and source like 'donkeyHire'
    V_CANDIDATE_ID     V_FNAME     V_CURRENT_EMPLOYER     V_EXPERIENCE_YEARS
    2     Vengu     Andale Tech     4
    But the record does not show up in the report!
    does this type of report parse page items as text?
    Why is it so?
    Waiting for an early reply.
    Thanks,
    venkat

    Venkat - You don't want to put ':SOURCES1' in quotes like that.
    Scott

  • 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 problem (PL/SQL function returning SQl query)

    I am using 3.1.2 Apex. When I create the region source with the following code.
    DECLARE
    l_sql VARCHAR2(32767);
    X1 VARCHAR2(9);
    X2 VARCHAR2(9);
    X3 VARCHAR2(9);
    X4 VARCHAR2(9);
    X5 VARCHAR2(9);
    X6 VARCHAR2(9);
    X7 VARCHAR2(9);
    X8 VARCHAR2(9);
    BEGIN
    SELECT decode(:P3_FAILED_CDD,'0','0','1','1', '2','2' ) INTO X2
    FROM DUAL;
    SELECT decode(:P3_Order_status,'J','J','1','1','2') INTO X3
    FROM DUAL;
    SELECT decode(:P3_FAILED_STAGE,'0','0','1','1','2') INTO X4
    FROM DUAL;
    SELECT decode(:P3_ORDER_TYPE,'TYPE1','TYPE1','TYPE2','TYPE2','2') INTO X5
    FROM DUAL;
    SELECT decode(:P3_INCLUDE_SFIN,'NO','NO','YES','YES') INTO X6
    FROM DUAL;
    SELECT decode(:P3_CDD_MATCH,'0','0','1','1', '2','2' ) INTO X7
    FROM DUAL;
    SELECT decode(:P3_FIELD,'0','0','1','1', '2','2' ) INTO X8
    FROM DUAL;
    l_sql := 'SELECT
    ORDER_NR,
    FNN,
    ST,
    SOT,
    STAGE,
    CUST_NAME,
    STG_DAYS,
    ZONE,
    P1.OWNER,
    QUEUE_A,
    STG_LFD,
    LFD_LEFT,
    CIJ_FLAG,
    FST_FLAG,
    CCD_COUNT,
    TCD_COUNT,
    LATEST_RET_CODE,
    CRD,
    CDD_DATE,
    CRD_LEFT CDD_LEFT,
    TCD_DATE RTCD_DATE,
    PROP_TCD_DATE TCD_DATE,
    PROJECT_ID,
    APPLN_TBO,
    CO_ORD_ID,
    CON_WSTN,
    P1.STATE,
    A_DTB,
    B_DTB,
    DESIGN_NO,
    CREATE_DATE,
    DATE_APPLN,
    CUSTOMER_ID,
    SALES_QUEUE,
    TRACKING_NR,
    WORK_REQUIRED,
    SFIN_STAGE_ENTERED_DATE,
    APPLN_CONTACT_OFFICER,
    A_LOCATION_ADDRESS,
    B_LOCATION_ADDRESS,
    SO_CREATE_USERID,
    OP_SEP,
    WMC_CODE
    FROM RASS_TICKET_VIEW P1
    WHERE WMC_CODE like :p3_wmc_code
    AND ST in (SELECT SYSTEM_ID from PRDRF where PRODUCT_CATEGORY like :p3_product_cat)';
    IF X2 = '0' then
    l_sql := l_sql || ' and CRD_LEFT < 0';
    END IF;
    IF X2 = '1' then
    l_sql := l_sql || ' and CRD_LEFT >= 0';
    END IF;
    IF X3 = 'J' then
    l_sql := l_sql || ' and CIJ_FLAG = ''J''';
    END IF;
    IF X3 = '1' then
    l_sql := l_sql || ' and CIJ_FLAG is null';
    END IF;
    IF X4 = '0' then
    l_sql := l_sql || ' and LFD_LEFT < 0';
    END IF;
    IF X4 = '1' then
    l_sql := l_sql || ' and LFD_LEFT >= 0';
    END IF;
    IF X5 = 'TYPE1' then
    l_sql := l_sql || ' and SOT in (''NEW'',''NET'',''ERT'',''UGP'')';
    END IF;
    IF X5 = 'TYPE2' then
    l_sql := l_sql || ' and SOT not in (''NEW'',''NET'',''ERT'',''UGP'')';
    END IF;
    IF X6 = 'NO' then
    l_sql := l_sql || ' and STAGE in (''DSAL'',''DPLO'',''OISS'',''TRPB'',''OTST'',''TEQP'',''DSPS'')';
    END IF;
    IF X7 = '0' then
    l_sql := l_sql || ' and PROP_TCD_DATE <= CDD_DATE';
    END IF;
    IF     X7 = '1' then
    l_sql := l_sql || ' and PROP_TCD_DATE > CDD_DATE';
    END IF;
    RETURN l_sql;
    END;
    The query returns data.
    If I add some more code just after the where clause.
    AND decode(CUST_CODE,'TW','TW','RET') like (select decode(OPS_SEP,'TS','%',OPS_SEP) from T_U_CDW_BU_OP_SEP where upper(USER_ID) = upper(:APP_USER))
    The query just stops working and no error message is returned.
    I thought there was an issue prior to version 3.1.2 that was fixed in version 3.1.2
    Othwerwise is there a better way to write the code? As I have 7 radio btn's that control the condition within the where clause.
    Thanks
    Ron

    >
    bug in APEX 3.0
    >
    Are you sure?
    Do as Paul has suggested and post the code that doesn't work (including your extra line) using the {noformat}{noformat} tags +exactly+ as you had it in the region source.
    Cheers
    Ben                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Plugin with PL SQL function returning query

    Hi all,
    I have created plugin using SQL query many times. But can we create a plugin from scratch using PL SQL function returning SQL query? Any ideas or sample.
    Thanks
    Sunil Bhatia

    Hi Scott,
    By this i mean, i have created a region type plugin for integrating jqx Grid into oracle apex. This takes input parameter as SQL statement, and creates jqx grid for me on page. Now my question is, can i do this using PL SQL function returning SQL, because when i try to give return statement, plugin gives error "SQL statement mandatory'. I hope i am clear enough now.
    Thanks
    Sunil Bhatia

  • Using 'Function Returning SQL Query' with Flash charts

    I have created a pl/sql function that returns a SQL query as a varchar2 of this form:
    select null link
    <x value> value
    <Series1 y value> Series 1 Label
    <Series2 y value> Series 2 Label
    <Series3 y value> Series 3 Label
    from tablea a
    join tableb b
    on a.col = b.col
    order by <x value>
    If I now call the function from a Flash Chart Series SQL box with the Query Source Type set to 'Function Returning SQL Query' like this:
    return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'))
    it parses correctly and the page is saved; however, when I run the page I don't get any output - nor any error messages or other indication of a problem.
    Now, if I call the function in a SQL client, capture the SQL query output using dbms_output and paste that into the Flash Chart Series SQL box - changing the Query Source Type to SQL Query - and save the page it works fine when I run it and returns a multi-series flash chart.
    Can anyone suggest either;
    1. What have I might have missed or done wrong?
    2. Any way to usefully diagnose the problem...
    I have tried using the Apex debugger - which is very nice, by the way - but it doesn't provide any info on what my problem might be. I even tried writing my own debug messages from my function using the apex_debug_message package - got nothing...
    Thanks,
    Eric

    Hi Eric,
    Try expressing the source as this:
    begin
       return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
    end;That works fine for me, and if I take out the begin-end and the trailing semicolon from the return statement I get the same behavior as you.
    It does mention in the help for the source (only during the wizard though) that this source type has to be expressed that way, but I agree it would be helpful if the tool would validate for this format when 'Function Returning SQL Query' is used or give some sort of indication of the trouble. Anyway, this should get you going again.
    Hope this helps,
    John
    If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well.

  • PL/SQL function returning a colon delimited list of headings

    Hello,
    Apex version 4.1.0.23. I am editing an existing classic report which has the column heading option set to 'PL/SQL function returning a colon delimited list of headings'. I have been looking for some time but I cannot find where this PL/SQL function is defined. Can any one point me to the right direction? I do not see anything in the documentation either.
    Thanks,
    Usman

    Hi Usman,
    I looked into this issue and found that there's some JavaScript code executed when opening the page with the PL/SQL headings option enabled, or when selecting that option after loading the page, and this JavaScript attempts to set a background color for the column heading fields. Since we only display attributes for up to 100 columns, this JavaScript fails once you have more than 100 columns.
    I would certainly agree with Tony that 60 or 100 columns are a bit much. But there should be some indication why something is not working, even if it's only a message stating that there's only a certain number of columns supported. So I'll log a bug to improve this in APEX 5.0.
    Thanks,
    Marc

  • Interactive Report based on a function returning SQL query?

    Hi guys!
    I'm wondering if the IR based on a function returning SQL query will be available on the final release of APEX 4.0..I can't see this functionality in EA1 and EA2 and I think it should be there..dont you think?
    With regards,
    PsmakR

    Hi!
    You're absolutely sure you're talking about the Interactive Report region and not about the default SQL Report region ?
    With regards,
    PsmakR

  • How to return less than 4000 characters from pl/sql function in SQL call?

    Hello,
    Is there a way to limit length for varchar when calling pl/sql function from SQL? No matter how I write it it always returns 4000 bytes.
    If there is none, then does it make sense ever to specify lenght of the return variable?
    My goal is to encapsulate business rules within pl/sql functions. But if all varchar columns are returned as 4000 it is not feasible solution. Not only this is a performance issue in a data warehousing environment, bet when using those rules within SQL views user experiance would suffer as well. Are we left with the rule hardcoding solution? Also, I think that using SUBSTRING or TRUNC functions on top of business rules function defeats the purpose.
    Please see my attempt below. Your thoughts are appreciated.
    Thank you.
    /* Formatted on 06/11/2009 2:26:41 PM (QP5 v5.126.903.23003) */
    CREATE OR REPLACE FUNCTION mytest (myvar_in VARCHAR2)
    RETURN VARCHAR2
    AS
    l_return VARCHAR2 (15);
    BEGIN
    l_return := 'TEST_' || myvar_in;
    RETURN l_return;
    END mytest;
    CREATE TABLE TEST_ME
    AS
    SELECT mytest ('ME') AS VERYLONG FROM DUAL;
    describe TEST_ME;
    RUN ABOVE CODE:
    Function created.
    Table created.
    TABLE TEST_ME
    Name Null? Type
    VERYLONG VARCHAR2(4000)
    Edited by: Ilmars2 on Jun 11, 2009 2:46 PM

    Pointless,
    Thanks for jumping in on this and I am glad you asked :).
    I do not doubt that it is an architectural challenge. Otherwise it would have been done already! I am struggling with the fact that SQL knows what data type the function will return, but does not know the length of it, precision or scale. I will leave it at that.
    I will go with some high level requirements to allow for alternative thoughts:
    1)     Business defined rules. There are multiple types of business rules. Simple lookups, bucketing, complex calculations, data retrieved from other tables etc. We have about 500 different rules. Some of them are even overloaded – different inputs will produce the same output.
    Some simple examples are:
    Rule1 - Fruit
         when ‘A’ then ‘Apple’
         When ‘O’ then ‘Orange’
         Else ‘N/A’ end
    Rule2 – Bonus
         when STATUS =’Active’ and LEVEL=’CEO’ then bonus=salary*1.0
         when STATUS =’Active’ and LEVEL=’nobody’ then bonus=salary*0.01
         else bonus=0
    Rule 3 – Income Bracket
         When more than 0 and less or equal to 30000 then INC_B=’LOW’
         When more than 30000 and less of equal to 60000 then INC_B=’MIDDLE’
    Etc.
    2)     Challenge: All data users in an organization need to use the same rules (let’s assume data source is Oracle database). How to expose all the rules to different types of users in manageable way? Types of users – analysts, application/web developers, data warehouse teams etc.
    3)     Current system: Not only each user has coded their own rules (luckily based on the common specification), but hard-coding is taking place for each query within the confines of one project. The project I just looked at had about 12 modules with 30 hardcoded queries. Oops! Few rules just changed.
    My take: I was leaning toward encapsulating business logic within UDF’s. UDF’s provide all the flexibility we need + overloading. All the functions could be consumed by data warehouse team (building summary tables, cubes etc.) and application developers. For power users we could build views by applying the same functions on top of the source data. Thus avoid data duplication. It seemed win-win until this 4000 issue :).
    Your thoughts on alternative approaches are appreciated.
    Thank you.

  • PL/SQL function returning a SQL Query

    Is this only availabe in HTML db or in 10g in general? Where do I find more about this feature?
    Thanks in advance,
    Denes

    Not sure what you mean. HTML DB allows to use a PL/SQL function returning a valid SQL query in report regions.
    Its just a PL/SQL function returning a string, outside of HTML DB, I guess you can use it wherever it makes sense.

  • PL/SQL: Function returned without value in authentication schemes

    Hi all,
    finally i did the authentication shemes based on my function and my own table ,thank you all for help :-) ,but now when i enter
    1-correct user name &wrong password <it is gonna work,the authentication workin fine >
    i am gonna get <Invalid Login Credentials> which is right in case of wrong login
    2-wrong user name &wrong password <it is not gonna work>
    3-wrong user name &correct password <it not gonna work>
    in case of not working i am getting the following error:
    ORA-06503: PL/SQL: Function returned without value
    Error ERR-10460 Unable to run authentication credential check function.
    any help to solve this issue so that it will display <Invalid Login Credentials>
    in all cases of invalid login
    thanks in advance ,
    Ahmed,

    scott,you efforts was useful and i beleive that the error that i am getting it is from the function that i have can you please take a look on :
    FUNCTION CHECK_USER
    ( P_USERNAME IN varchar2,
    P_PASSWORD IN varchar2)
    RETURN boolean
    IS
    BEGIN
    for c1 in (select user_name, password from vms2_employee_details where user_name = P_USERNAME)
    loop
    if P_PASSWORD = c1.password then
    return true;
    ------dbms_output.put_line('the return from the function is true');
    else
    return false;
    ----dbms_output.put_line('the return from the function is false');
    end if;
    end loop;
    EXCEPTION
    WHEN no_data_found THEN
    return false;
    when others then
    return false;
    ----dbms_output.put_line('the return from the function is false');
    END;
    and tell me what do you think ,
    thanks,
    ahmed

Maybe you are looking for

  • Can you open a closed network?

    I can no longer access the secure wi fi network set up on my Mac Pro, and must use  the (insecure) network that came with my router. The regular network name doesn't show as an available network, but I know it is still there because both the name and

  • Importing animated gif

    I am trying to import an animated gif into a pre-existing layered photoshop file. I am using photoshop CS3 on a Mac OS X 10.5. I tried file -> import -> video frames to layers, but it does not recognize the gif file and there is no place to manually

  • Error Message in xcode: Command /usr/bin/codesign failed with exit code 1

    I am attempting build my iPad application on my device and I have went though the provisioning and successfully created an App ID, provisioning, etc. and when i 'Build and go' i get this error message: *Command /usr/bin/codesign failed with exit code

  • How to upload bank stament

    HI ALL Experts please give me some way how to upload bank stament if any way than give some solu.. Regards kalpen

  • How to print standard report region to a PC printer via Win printer driver?

    I know it's not very sexy, but sometimes an app user needs to print a standard report region to a printer that is connected to their PC. So that they can print their Apex report in the same manner as they do everything else from their PC, using a pre