Pl/sql block returning sql query.

Hello,
I am using oracle 10g apex 3.2 version.
I am using the following return statement inside my report which is pl/sql block returning sql query.
declare
pid varchar2(100);
begin
return 'select patient_id_code from t_files_data_exp where patient_id_code not in pid';
end;
How am i suppose to mention the pid inside the return stmt i mean with any quotes or anything? because the above return stmt gives error
"1 error has occurred
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. The query can not be parsed, the cursor is not yet open or a function returning a SQL query returned without a value."
Thanks

Hello,
I did exactly the way u told
declare
pid varchar2(100) := '(61092,61093)';
begin
return 'select patient_id_code from t_files_data_exp where patient_id_code not in ' || pid;
end;
patient_id_code is varchar2(100) only in table.
For this i am getting "invalid number error".
Thanks

Similar Messages

  • 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

  • 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?

  • 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

  • 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;

  • Date format in PL/SQL Procuredure returning SQL Query

    We have parameters (a begin date and end date) that are entered in on a form and then passed as parameters to a report that is displayed using PL/SQL Procedure returning SQL Query. We would like the users to be able to enter the date in the format of mm/dd/yyyy but when we change the format mask on the begin and end date fields we get invalid month entered. I then went into my PL/SQL procedure and changed the code to the following
    q := q || ' WHERE ' ||
    '(:P41_W_BEGIN_DT IS NULL OR (:P41_W_BEGIN_DT IS NOT NULL AND
    :P41_W_BEGIN_DT <= to_char(HARDWARE_INFO.WARRANTY_END_DT,''mm/dd/yyyy')))
    AND
    (:P41_W_END_DT IS NULL OR (:P41_W_END_DT IS NOT NULL AND :P41_W_END_DT >=
    to_char(HARDWARE_INFO.WARRANTY_END_DT,''mm/dd/yyyy''))
    The code is accepted but when we run the report against the parameters it seems to only be looking at the mm/dd constraint it pays no attention to the YYYY constraint. In the to_char condition if I try using single tick marks it errors out. The only way I can get the tick marks to be accepted in the code is to use 2 single tick marks ''. Any ideas on what I am doing wrong.
    Thanks!

    user520671,
    You are doing the conversion in reverse. Because you're applying a function (TO_CHAR) to the columns in your predicate, you'll be negating the use of any indexes. Not prudent from a performance standpoint.
    Instead, convert your input values to a date and do the comparison that way.
    q := q || ' WHERE ' ||
    '(:P41_W_BEGIN_DT IS NULL OR
        (:P41_W_BEGIN_DT IS NOT NULL AND to_date(:P41_W_BEGIN_DT,''MM/DD/YYYY'') <= HARDWARE_INFO.WARRANTY_END_DT))
    AND
    (:P41_W_END_DT IS NULL OR
        (:P41_W_END_DT IS NOT NULL AND to_date(:P41_W_END_DT,''MM/DD/YYYY'') >= HARDWARE_INFO.WARRANTY_END_DT))'Also ensure that you are truly passing in a 4-digit year.
    Joel

  • PL/SQL block returning error

    Hi All,
    I have used PL/SQL block in my custom report to search table heading. Basically I have two select list (LOV), user select the parameter from the list and click on go, it displays the report fine when record exists.
    I am using following PL/SQL block -
    >
    DECLARE
    v_sql VARCHAR2(4000);
    BEGIN
    IF :P126_PARK_NAME IS NOT NULL THEN
    v_sql := 'select P.OLIC_KEY1, PA.NAME, C.TRADING_NAME, L.LIC_TYPE, P.'|| :P126_PARK_NAME ||', C.COP_ID, L.OLIC_ID Olic_id '
    ||' from RTT_OP_PARKS_TEMP P, RTT_COMMERCIAL_OPERATORS C , RTT_PARTIES PA, RTT_OP_LICENCES L'
    ||' where '|| :P126_PARK_NAME || ' IS NOT NULL '
    ||' AND PA.PAR_ID =C.PAR_ID '
    ||' AND P.COP_ID =C.COP_ID '
    ||' AND L.OLIC_KEY1=P.OLIC_KEY1 '
    ||' AND :P126_QUERY = ''Y'''
    ||' ORDER BY PA.NAME ';
    END IF;
    /* debugging */
    IF :DEBUG = 'YES' THEN
    htp.preopen;
    htp.p(v_sql);
    htp.preclose;
    END IF;
    RETURN (v_sql);
    END;
    >
    Now, I want to use like condition to display all the records by checking the parameters in text field. I have created a new text field and modified the query as follows but it does not work -
    >
    DECLARE
    v_sql VARCHAR2(4000);
    BEGIN
    IF :P126_PARK_NAME IS NOT NULL THEN
    v_sql := 'select P.OLIC_KEY1, PA.NAME, C.TRADING_NAME, L.LIC_TYPE, P.'|| :P126_PARK_NAME ||', C.COP_ID, L.OLIC_ID Olic_id '
    ||' from RTT_OP_PARKS_TEMP P, RTT_COMMERCIAL_OPERATORS C , RTT_PARTIES PA, RTT_OP_LICENCES L'
    ||' where '|| :P126_PARK_NAME || ' IS NOT NULL '
    ||' AND PA.PAR_ID =C.PAR_ID '
    ||' AND P.COP_ID =C.COP_ID '
    ||' AND L.OLIC_KEY1=P.OLIC_KEY1 '
    ||' AND :P126_QUERY = ''Y'''
    ||' ORDER BY PA.NAME ';
    END IF;
    IF :P126_MARINE_PARK != -1 THEN
    v_sql := 'select distinct L.OLIC_KEY1, PA.NAME, C.TRADING_NAME, L.LIC_TYPE, M.'|| :P126_MARINE_PARK ||', C.COP_ID '
    ||' from RTT_OP_MARINE_PARKS M, RTT_COMMERCIAL_OPERATORS C , RTT_PARTIES PA, RTT_OP_LICENCES L'
    ||' where '|| :P126_MARINE_PARK || ' IS NOT NULL '
    ||' M.'||:P126_MARINE_PARK||' IS LIKE :P126_MARINE_PARK||'%' '
    ||' AND PA.PAR_ID =C.PAR_ID '
    ||' AND M.COP_ID =C.COP_ID '
    ||' AND L.OLIC_KEY1=M.OLIC_KEY1 '
    ||' AND :P126_QUERY = ''Y'''
    ||' ORDER BY PA.NAME ';
    END IF;
    /* debugging */
    IF :DEBUG = 'YES' THEN
    htp.preopen;
    htp.p(v_sql);
    htp.preclose;
    END IF;
    RETURN (v_sql);
    END;
    >
    Can anybody tell me what I am doing wrong here?
    Thanks in advance
    Regards,
    M Tajuddin

    Hi Andy,
    Thanks for pointing the quotation however it does not work either. Now I am getting -
    >
    failed to parse SQL query:
    ORA-00933: SQL command not properly ended
    >
    Now my query is like below -
    >
    DECLARE
    v_sql VARCHAR2(4000);
    BEGIN
    IF :P126_ZONE_NAME IS NOT NULL THEN
    v_sql := 'select distinct L.OLIC_KEY1, PA.NAME, C.TRADING_NAME, L.LIC_TYPE, M.'|| :P126_ZONE_NAME ||', C.COP_ID '
    ||' from RTT_OP_MARINE_PARKS M, RTT_COMMERCIAL_OPERATORS C , RTT_PARTIES PA, RTT_OP_LICENCES L'
    ||' where '|| :P126_ZONE_NAME || ' IS NOT NULL '
    ||' AND PA.PAR_ID =C.PAR_ID '
    ||' AND M.COP_ID =C.COP_ID '
    ||' AND L.OLIC_KEY1=M.OLIC_KEY1 '
    ||' AND :P126_QUERY = ''Y'''
    ||' ORDER BY PA.NAME ';
    END IF;
    IF :P126_MARINE_PARK IS NOT NULL THEN
    v_sql := 'select distinct L.OLIC_KEY1, PA.NAME, C.TRADING_NAME, L.LIC_TYPE, M.'|| :P126_MARINE_PARK ||', C.COP_ID '
    ||' from RTT_OP_MARINE_PARKS M, RTT_COMMERCIAL_OPERATORS C , RTT_PARTIES PA, RTT_OP_LICENCES L'
    ||' where ' || :P126_MARINE_PARK || ' IS NOT NULL '
    *||' M.' || :P126_MARINE_PARK || ' IS LIKE ''' || :P126_MARINE_PARK || '%'' '*
    ||' AND PA.PAR_ID =C.PAR_ID '
    ||' AND M.COP_ID =C.COP_ID '
    ||' AND L.OLIC_KEY1=M.OLIC_KEY1 '
    ||' AND :P126_QUERY = ''Y'''
    ||' ORDER BY PA.NAME ';
    END IF;
    /* debugging */
    IF :DEBUG = 'YES' THEN
    htp.preopen;
    htp.p(v_sql);
    htp.preclose;
    END IF;
    RETURN (v_sql);
    END;
    >
    Can you tell me how can I display dynamic multiple column in my query? Say in the LIKE condition if user type M in the parameter field and click on go, it must return more than one column starting column name M but in my current query it will only display one column, am I right?
    Thanks again for your suggestion.
    Kind regards,
    M Tajuddin
    http://tajuddin.whitepagesbd.com

  • 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

  • Using item values in a pl/sql block or sql query in a process

    Hi,
    I am new to apex. Developing my first application.
    I have created a form with 2 items. Based on the values in these items, when I click a button, want to execute a
    query.
    eg: emp_name(item1), deptno(item2). When I clock on find button, I want to fetch the record and disply the resultant
    columns in other created items like sal,comm etc.
    How can I do this?
    I tried the following pl/sql block in a process
    begin
    select sal,comm into p1_sal,p1_comm from emp where name=p1_name and deptno=deptno;
    end;
    But it is not accepting the page items in the block.
    How to achieve this?
    Thanks,
    Kavitha

    We have many OBEs, tutorials, etc. Please visit the <a hef="http://www.oracle.com/technetwork/developer-tools/apex/learnmore/index.html" target="_window">Learn More</a> tab of our otn site.
    This is the section of the User's Guide that discusses session state -
    -- Sharon

  • Using collections / Bind variables with a PL/SQL functio returning a query

    I have this code, which is supposed to assign collection variables as column names
    FOR i in 1 .. Collection_count -1
    LOOP
    SELECT c002 into :P341_M1 FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=i;
    SELECT c002 into varholder FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=i;
    vQuery:= vQuery || 'SUM(decode(label, ''Aware'', product_'|| i || ', ''Expert'', product_' || i || ', ''Proficient'', product_' || i || ', ''Advanced(Demo)'', product_' || i || ' )) as ';
    vQuery:=vQuery || varholder || ', ' ;
    END LOOP;
    I've tried &P341_M1. , :P341_M1, ':P341_M1', varholder
    When I try '&P341_M1' it returns the whole SUM(decode... line as the label
    Basically Im having a hard time using bind variables with the PL/SQL returning a query...anybody?

    Ok so working through this problem more I have realized that the problem is using the for loop i as an index value
    This will get a value:
    SELECT c002 into :P341_M1 FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=2;
    But this won't
    SELECT c002 into :P341_M1 FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=i;
    I'm in the for loop, and use the i variable in other places within this loop...Is there a reason why I can't compare seq_id to i?
    My new code as follows:
    FOR i in 1 .. Collection_count -1 --apex_application.g_f01.COUNT - 1
    LOOP
    varholder:=i;
    SELECT c002 into :P341_M1 FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=2;
    SELECT c002 into varholder FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=4;
    vQuery:= vQuery || 'SUM(decode(label, ''Aware'', product_'|| i || ', ''Expert'', product_' || i || ', ''Proficient'', product_' || i || ', ''Advanced(Demo)'', product_' || i || ' )) as f';
    vQuery:=vQuery || :P341_M1 ||i||', ' ;
    END LOOP;

  • 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

  • Dyn sql execute immediate  A plsql block returning sql%rowcount of rows inserted

    I would like to get the number of rows inserted in a dynamic sql statement like following.
    execute immediate
    'begin insert into a(c1,c2,c3)
    (select ac1,ac2,ac3 from ac where ac1=:thekey
    UNION select tc1,tc2,tc3 from tc where tc1=:otherkey); end;' using in key1,in key2;
    I have tried per the oracle8i dyn sql chapter in doc RETURN sql%rowcount won't compile.
    also add this to statement 'returning sql%rowcount into :rowcount'
    no luck.
    any ideas.?
    thanks.

    Quick comment first - I'm not sure why you are even using dynamic SQL here. There is nothing dynamic about your statement. It is equivalent to just:
    insert into a (c1, c2, c3)
      select ac1, ac2, ac3
        from ac
       where ac1 = key1
      UNION
      select tc1, tc2, tc3
        from tc
       where tc1 = key2;Unless you are really dynamically changing a table or column name here and just didn't show it in your example, you certainly don't want the overhead of NDS for this insert in this situation.
    In any case, you just need to evaluate SQL%ROWCOUNT in the next statement.
    insert ...;
    if sql%rowcount = 0 then
      -- nothing was inserted
    end if;

  • Pl/Sql block returning too many values

    Hi
    Below is simple pl/sql block.while excecuting this i'm getting too many values exception
    declare
    attrib QW_ACCT_ATTR%ROWTYPE;
    begin
    SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL INTO attrib FROM (SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL FROM QW_ACCT_ATTR where CUST_ACCT_ID='5158660414' AND ATTR_NM = 'SS' ORDER BY ATTR_END_DATE DESC) where rownum = 1;
    DBMS_OUTPUT.PUT_LINE('end daate is...'||attrib.ATTR_END_DATE);
    end;
    could anybody please help me how to rewrite this qwery to get only one record.
    we are not supposed to use cursors here,
    thanks

    I am just changing your logic,
    declare
    attrib QW_ACCT_ATTR%ROWTYPE;
    begin
    SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL INTO attrib FROM (SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL FROM QW_ACCT_ATTR where CUST_ACCT_ID='5158660414' AND ATTR_NM = 'SS' ORDER BY ATTR_END_DATE DESC where rownum = 1) ;
    DBMS_OUTPUT.PUT_LINE('end daate is...'||attrib.ATTR_END_DATE);
    end;

  • PL/SQL block to sql case

    Hello,
    I have a newbie sql question:
    I have the following pl/sql block that I want to transform in sql case code:
                 IF Num_WholesaleNonDiscountValue > 0.0 THEN
                      UsageStatus := 'CHARGE';
                      if Num_WholesaleNonDiscountValue < 1.0 then
                          WholesaleNonDiscountValue := '0' || TO_CHAR(Num_WholesaleNonDiscountValue);
                        else
                          WholesaleNonDiscountValue := TO_CHAR(Num_WholesaleNonDiscountValue);
                      end if;
                  ELSE
                      UsageStatus := 'FREE';
                      WholesaleNonDiscountValue := TO_CHAR(Num_WholesaleNonDiscountValue);
                  END IF;All I do is the following code:
    select (case when Num_WholesaleNonDiscountValue > 0.0 then
                              (case Num_WholesaleNonDiscountValue < 1.0 then  '0' || TO_CHAR(Num_WholesaleNonDiscountValue
                               else TO_CHAR(Num_WholesaleNonDiscountValue))
             else TO_CHAR(Num_WholesaleNonDiscountValue)) from table_name;I do not know how to evaluate the UsageStatus variable, where to put it in the select statement.
    This is for my learning process.
    Thanks in advanced,
    Dan
    Edited by: danut68 on Jan 13, 2010 5:52 AM

    Hi, Dan,
    I think you want something like this:
    SELECT     CASE
              WHEN  Num_WholesaleNonDiscountValue > 0
              THEN  'CHARGE'
              ELSE  'FREE'
         END                              AS UsageStatus
    ,     CASE
              WHEN  Num_WholesaleNonDiscountValue > 0
              AND   Num_WholesaleNonDiscountValue < 1
              THEN  '0'
         END || TO_CHAR (Num_WholesaleNonDiscountValue)     AS WholesaleNonDiscountValue
    FROM     table_x
    ;A CASE expression returns one value.
    In PL/SQL, you can do two or more completely separate things (set two different variables, for example) in the same IF-THEN-ELSE block.
    To get the same results in SQL requires a completely different approach.
    The clearest is to use a different CASE expression for each of the things you're trying to do, as I did above. The WHEN clauses of those CASE statements may be very similar, even identical.
    Sometimes you can factor out some of the logic (using a sub-query, perhaps) so that the logic that has to be repeated in each CASE expression is very simple.
    Another option for setting two variables is to have a single CASE expression that returns a string wihich is the concatenation of two different varibales, which you later parse into two separate variables. I would do this only as a last resort.

Maybe you are looking for

  • Acrobat 9 - hyper link issue and print in larger font

    I am using Acrobat 9 and have two issues : When I try to convert a web page to pdf file i.e. through the print command in FF, the text links are there in the new file but without the underlying hyper links ? How can I print the files with a larger fo

  • IPhone 5 audio issues when paired with surround sound via Bluetooth.

    iPhone 5 has developed audio issues since ios7 updates when its connected to surround sound system via Bluetooth. Audio jumps and skips in erratic and unpredictable manner on music app and worse on third party apps such as YouTube  . Have restored ph

  • Output via firewire with studio 2

    I have recently set up a FCP Studio 2 system with a kona LHe card and am having a hard time outputing to dvd. We are using an HD player deck (JH-3) and our analog outputs from the kona are component only. DVD players only take s-video and composite.

  • SQL Tracing in TimesTen with actual data visible

    Hi, We're having some issues with our TimesTen-based application where under some circumstances (it appears to increase under load) the results appear to get 'mixed up', i.e. a query appears to not have received the right result set from the database

  • Mac os x 10.6.6 on final cut pro

    Hello, I am thinking to download Final Cut Pro X. However my mac book pro is a Mac OS X v10.6.6 will I be able to the program or do I have to upgrade to v10.6.8. And if I do have to upgrade where can I get the 10.6.8 version? Please reply back asap.