PL/SQL Function source of text field

I have the following code as a PL/SQL function body as the source of a text item. There is a group_options table that specifies if the user group selected has fixed pricing or
can key in a price. For the fixed price groups, I was wanting to have the text field auto-populate and for the nonfixed price groups, I just wanted an empty text field for them to key in the price. The check boxes on the page for purchasing an item or leasing an item determine which table the pricing comes from. I don't get an error message, but there is something APEX doesn't like about the code below because I get the 'page cannot be found' message. Do you see a problem with the code below? Last week, it would not work and then mysteriously started to work. Today, it started out not working, so there has to be something flakey about it.
Thank you in advance.
Kelly
DECLARE
vfixed NUMBER;
vpurprice NUMBER;
vleasprice NUMBER;
BEGIN
SELECT FIXED_PRICE INTO vfixed FROM UPSL_DEV.GROUP_OPTIONS WHERE USER_GROUP =
:P7_GROUP ;
IF vfixed = 1 and :P9_PURCHASE = 1 THEN
SELECT PURCHASE_PRICE INTO vpurprice FROM UPSL_DEV.PRICE_GRID g WHERE g.user_GROUP = :P7_GROUP and g.equip_code =:P9_ITEMCODE ;
return vpurprice;
ELSIF vfixed = 0 and :P9_PURCHASE = 1 THEN
return NULL;
END if;
IF vfixed = 1 and :P9_LEASE = 1 THEN
SELECT MIN into vleasprice from UPSL_DEV.PRICE_GRID_LEASE l WHERE l.equip_code = :P9_ITEMCODE AND l.user_group = :P7_GROUP and l.term = :P9_LEASETERM;
RETURN vleasprice;
ELSIF vfixed = 0 and :P9_LEASE = 1 then
RETURN NULL;
END if;
END;

Put a "return null;" statement at the end of the block to allow for your logic not covering all cases. It may presently be getting a "function returned without value" error that is inconveniently suppressed in the page output.
Just a guess.
Scott

Similar Messages

  • Interactive Report with PL/SQL Function Source

    Is it possible to create interactive report with PL/SQL function source returing a query? If not, has anyone done any work to simulate the interactive reporting feature for a normal report using API?

    I haven't tried that before but you could:
    1. create a collection from your result set returned by a dynamic query,
    2. create a view on that collection,
    3. use the view in your interactive report.
    The usability of this proposal depends from a question how "dynamic" your query is - does it always have the same number of columns or not.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to display the return value of a function in a text field

    Hi,
    I have 2 textfields in a page.
    i> Empno
    ii> Salary
    The requirement is,
    i. Enter an Employee No.
    ii. On click of the 'SUBMIT' button a process would be executed which calls a function (or procedure with out parameter) which returns the Salary of the given Employee.
    iii. Need to display the salary to the 2nd textfield (Salary).
    Here is my process:
    i. If procedure call-- :P2_X is a page text field and out parameter.
    begin
    Pri_test_PROC(:P2_EMPNO,:P2_X);
    end;ii. If Function call --
    begin
    :P2_X:=Pri_test_PROC(:P2_EMPNO);
    end;
    Issue:
    The process is not getting executed and returning the process error message.
    Could anyone please give me a pointer, how to overcome the issue. Or if this is not the right way, then what is the work around.
    Regards
    Antara

    Antara,
    1. Clue about the error - yes, when I see the error message.
    2. What happens if you try to create a procedure like this:
    CREATE OR REPLACE PROCEDURE fetch_sal (in_emp IN NUMBER, out_sal OUT NUMBER)
    IS
    BEGIN
       FOR c IN (SELECT sal
                   FROM emp
                  WHERE empno = in_emp)
       LOOP
          out_sal := c.sal;
       END LOOP;
    END;and then run this in SQL Plus:
    DECLARE
       v_sal   VARCHAR2 (20);
    BEGIN
       fetch_sal (7839, v_sal);
       DBMS_OUTPUT.put_line (v_sal);
    END;What do you get displayed?
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • SQL LIKE statement to text field fomr CF MX 6.1

    Hi.
    Here's my scenario. I am running SQL Server 2000 SP4 on a
    Windows 2003 Server running IIS 6. Using ColdFusion MX 6.1 Updater
    version.
    I am storing HTML page code (some complete, some just clips)
    in a text type field.
    I need to check to see if someone has already saved that
    exact code already before. So I do the following query:
    <cfquery name="checkforexisting"
    datasource="mydatasource">
    SELECT smallfieldtogetareturn
    FROM MyTable
    WHERE MyTextField LIKE '%#mystringoflongdata#%'
    </cfquery>
    Then to see if it posted:
    <cfif checkforexisting.RecordCount GT 0>
    do the don't clip optional processing
    </cfif>
    What is killing me is that it finds the match SOMETIMES. Just
    not ALL the time. I have tried no percent signs when passing the
    ColdFusion variable, only one on the right (which has solved these
    types of problems before).
    If I pull the record back OUT of the database in a page by
    itself (retrieving it by key field), it finds every other copy of
    the code EVERY time.
    I have put this into a stored procedure, which seemed to help
    I even have resorted to creating a temp table first with the
    clip, then running a query to retrieve the record that was just put
    in, and comparing THAT to my primary table (both have text type
    fields). The reason for this, is that if I write a single page that
    has just the retrieval of the temp record, and that compare is run,
    it finds EVERY copy of it in the primary table. I also thought that
    maybe there was a strong problem (I had tried HTMLEditFormat,
    HTMLCodeFormat, JavaCast since it was coming from a java program on
    the browser end).
    I am not terribly familiar with using large text fields, or
    dealing with these large pieces of HTML code as something to
    compare!
    - Mike

    MichaelSJudd wrote:
    As Dan indicated your most likely issue is slight differences
    in
    capitalization and|or white space or other 'invisible'
    difference
    between your strings. One can have nearly infinite variety in
    HTML code
    that will display identically in a browser, the standard is
    very
    forgiving of formatting differences.
    Something I have done in the past to compare HTML content is
    to use the
    hash() function. It will not help you eliminate the
    differences but it
    would show when something is different then it appears to be.
    #hash(mystringoflongdata)# will return a hexadecimal number
    representing
    the string. Two *exactly* the same strings will produce the
    same
    number. Then it is very easy to compare these numbers to see
    if two
    long strings are the same.
    To use this with your database data, you would probably have
    to store
    the hash value of the string in a field when you store the
    HTML data.
    HTH
    Ian

  • SQL Server 7 (n)text field

    Hi there,
    I was wondering what resultset method you use when you wish to retrieve information from the data type text (and ntext) datatype fields.
    Because this is a pointer, I can not use .getString()...unless there is something I am missing.
    In case it matters, this is using NetBeans and Java Server Pages.
    Cheers,
    John

    Why you can't use getString()? This should be work.
    Which driver do you use?
    Volker

  • Error converting SQL Server text field to Oracle CLOB

    I am trying to convert an SQL Server DB to Oracle DB using DB link. The issue I am facing is one of the SQL Server table contains text field and we are trying to convert the text field to CLOB.
    The error I am getting is "SQL Error: ORA-00997: illegal use of LONG datatype"
    The statement is something like this.
    Insert into oracle_table
    Select col_1,col_2,col_3,col_4,col_5 from sql_table@sqldblink;
    Please help.

    Hi,
      This is a known restriction involving long columns -
    (1) LONG datatype not supported with use of DBLINK when insert or update involves a select statement
    (2) LONG datatype cannot be used in a WHERE clause, in INSERT into ... SELECT ... FROM
    constructs, and in snapshots.
    The workround is to use a PL/SQL procedure or try the SQLPLUS COPY command.
    If you have access to My Oracle Support then review these notes -
    Cannot Move A Long From non Oracle database Ora-00997: Illegal Use Of Long Datatype (Doc ID 1246594.1)
    How To Workaround Error: Ora-00997: Illegal Use Of Long Datatype (Doc ID 361716.1)
    Regards,
    Mike

  • PL/SQL-Function for validation

    I wrote a PL/SQL function in order to validate that the SUM of input-values doesn't exceed 100.
    I used validation rule from APEX for PL/SQL-expression (same like SQL-expression):
    f_page_16_validation(:P16_PSP_PSP)<=100 (Condition: CREATE, SAVE)
    source code for function:
    CREATE OR REPLACE FUNCTION f_page_16_validation
    (pi_p16_psp_psp VARCHAR2)
    RETURN NUMBER
    IS
    vl_sum NUMBER(5) := 0;
    BEGIN
    SELECT NVL(SUM(psp_anteil_projekt),0) INTO vl_sum
    FROM st_psp_projekt_psp
    WHERE UPPER(psp_psp) = pi_p16_psp_psp;
    RETURN vl_sum;
    END f_page_16_validation;
    When I check in SQL*Plus against database: SELECT f_page_16_validation('A_TEST_UHL_PSP%') FROM dual;
    I get the correct value. When I input into APEX-Application the validation rule doesn't fire (CREATE). If my SUM is over 100 and try to change
    one value (in order to come under 100) (SAVE) - the validation rule fires but quite independent of the SUM - it accepts NO VALUE!!
    Apex-Version: 3.1.1.00.09
    Can somebody tell me what's wrong? Is there any other way - SQL,PL/SQL-expression, PL/SQL-function body (bool, error text) didn't work.

    1. If your PL/SQL expression is written as you stated:
    f_page_16_validation(:P16_PSP_PSP)<=100then you will receive an error message if the total is <= 100 and not if it exceeds 100.
    2. Where in your code do you consider the input values? I see that you are selecting from a table, where your already inserted values are but I see no input values. Are you using a form or a tabular form? If I look at the names of your buttons then I wouls say you are using a form.
    3. You are talking about condition. What type of condition you use? I would use a PL/SQL Expression like this:
    :REQUEST IN ('CREATE', 'SAVE')4. I would suggest to use a validation of type PL/SQL Function Returning Error Text since you can put all the code in one.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • HT5392 How can I use an Action List to re-order my layers in iAd Producer?  It looks like there's a tool for this, but I can't figure out how to use it.  I want to use a button to switch between a text field and a drawing pad layer.

    I am working on an iBooks Author Widget and want to allow the user to switch between drawing-pad functions and a text field on screen.  I'd like to create an action that will automatically re-order the layers so that the text field is accessible when typing but covered when writing by hand.  Then, I'd like the opposite to be available, so that the text field is accessible when typing, but the drawing pad is left alone.

    Have you tried using the selections in the Encore menu viewer that show you selected and activated states?

  • Populating text field with pl/sql expression or function

    Hi all,
    I have a function which return an object.
    create or replace type emp2_oty is object (server_name varchar2(20),
    status varchar2(4),
    refresh_on date,
    dw_refresh date)
    create or replace type emp2_nt is table of emp2_oty
    create or replace function testserver12 return emp2_nt
    is
    v_emp2_nt emp2_nt:=emp2_nt();
    a number;
    b number;
    c number;
    begin
    for r_emp in (select * from testing)
    loop
    a := extract(DAY FROM r_emp.dw_refresh);
    c := extract(DAY FROM r_emp.refresh_on);
    b := extract(DAY FROM SYSDATE);
    if (a != b) or (c != b) or (r_emp.status != 'on') then
    v_emp2_nt.extend; v_emp2_nt(v_emp2_nt.last):=emp2_oty(r_emp.server_name,r_emp.status,r_emp.refresh_on,r_emp.dw_refresh);
    end if;
    end loop;
    return v_emp2_nt;
    end testserver12;
    The pl/sql code to get the return value displayed. It works very fine in sqlworkshop.
    declare
    v_temp_nt emp2_nt;
    i number := 1;
    begin
    v_temp_nt:= testserver12();
    for i in (v_temp_nt.first)..(v_temp_nt.last) loop
    dbms_output.put_line(v_temp_nt(i).server_name||' '||v_temp_nt(i).status||' '||v_temp_nt(i).refresh_on ||' '||v_temp_nt(i).dw_refresh);
    end loop;
    end;
    I want it to get display the output into the text field.
    Please could any one help me to achieve this.
    Thanks in advance
    bye
    Srikavi

    Pretty easy, add a CHR(10) (ASCII for carriage return) in the string concatenation.
    e.g.
       l_result:= l_result || (v_temp_nt(i).server_name || ' ' ||
                     v_temp_nt(i).status || ' ' ||
                     v_temp_nt(i).refresh_on ||' ' ||
                     v_temp_nt(i).dw_refresh) || CHR(10);Also why over complicate the whole process by using objects and types by simplifying the code and also improving readability and maintenance by replacing the PL/SQL function body with something similar to (the conditions have been negated and may have not been what you meant in the first place)
    DECLARE
       v_text_return VARCHAR2(2000);
       l_cur CURSOR IS
          SELECT t.server_name,
                 t.status,
                 t.refresh_on,
                 t.dw_refresh
          FROM   testing t
          WHERE  To_Char(t.refresh_on, 'DD') = To_Char(SYSDATE, 'DD')
          AND    To_Char(t.dw_refresh, 'DD') = To_Char(SYSDATE, 'DD')
          AND    Upper(t.status) = 'ON');
    BEGIN
       FOR r_emp in l_cur
       LOOP
          v_text_return := v_text_return || r_emp.server_name || ' ' ||
                             r_emp.status || ' ' ||
                             r_emp.refresh_on || ' ' ||
                             r_emp.dw_refresh || CHR(10);
       END LOOP;
       RETURN v_text_return;
    END;Hope this helps

  • How to reference SQL column value for  page item text field

    greetings,
    I created a simple report based on sql query. the query is select employeeid,salary from emp_tbl. under the report column i see employeeid and salary. I created a page item text field with the source type pl/sql function body. inside this source is simple block.
    begin
    if salary < 10000 then
    return (1);
    else
    return (2);
    end if;
    end;
    from the error i take it that it doesn't understand salary. I have tried bind variable (:salary) , hash marks (#salary#), ampersand (&salary.) but nothing works. Is this even possible?
    thank you,
    mon

    Hi Mon,
    I think you will find that anything you do in Forms, you can achieve in Apex, but you may have to think a little differently. Finding direct equivalents in both environments may not be easy or even possible in some circumstances, but with a little knowledge and thought an equivalent overall business flow can be achieved that is just as efficient.
    For example, in Forms where you have a multi row block based on a table, if you need to add any derived fields then you will add these at the block level. I can see that this is what you are trying to achieve in Apex.
    In Apex this will be more easily achieved by specifying the derived fields as part of the query for the region, and if the derivation of the fields is complex you can use user defined functions. If you require page type items to be displayed such as text boxes, LOV's, radiogroups, datepickers etc then these can be embedded in the query with the use of the Apex API, see the APEX_ITEM supplied package.
    I know this is still very high level, but I hope it helps you on your way in your journey with Apex.
    Regards
    Andre

  • Converting SQL Server text field containing XML string to XI XML via JDBC

    Hello
    My client has a SQL Server database containing a field of type Text which contains an XML string e.g.
    <DispatchJob> <DispatchDateTime>2003-09-29T13:29:15</DispatchDateTime> <AssignedFSE>F118</AssignedFSE> <DispatchJobPurchase> <DealerID>14C5</DealerID> <DateOfPurchase>1997-10-01T00:00:00</DateOfPurchase> </DispatchJob>
    I am using JDBC to access this but could someone please recommend the best and easiest solution for converting this string to XI XML for subsequent mapping to BAPI or IDOC or ABAP Proxy and transmission to SAP. There are other fields as well in the database table so thoughts at the moment are to use a normal graphical message mapping followed by an XSL mapping. Will an XSL mapping be able to do this and if so is that the best solution?
    Also I need to do the reverse of this and take fields coming from SAP via BAPI,IDOC etc. and convert them to a single database table field as an XML string also via the JDBC adapter. What is the best way to do this. Could it be done simply with functions in the graphical mapping e.g. concatenate?
    Thank you in advance.
    Trevor

    Hi Michal
    Thanks for the prompt reply.
    I was anticipating XSLT for reading from the SQL Server database and converting the XML string.
    But how would you convert the individual fields from SAP into a single field as an XML string for storing in the SQL Server database? What approach would you use?
    Regards
    Trevor

  • 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

  • Text data source for the field Position(PLANS)

    Hi Experts,
    I have an infoobject ZPOSITION which i am using in a cube for this i can able to display key values but i want to display text for this ZPOSITION. The source for this field is Position(PLANS) which i have tacken from pa0001 table.
    I have an another infoobject 0HRPOSITION for this i have already loaded data using data source 0HRPOSITION_TEXT.
    Is there any other text datasources for this field Position(PLANS)?
    And
    Is it possible to load data from one info object to another info object?
    Regards,
    Sridhar.K

    Hi Sridhar,
    Check out in the infotype PA0001 for the check table for this field. In this table you will have the description for the field PLANS (Position).
    I request you to catch hold of functional HR team member to know where the text value for the Position (PLANS) is stored. You can get the info from them immeadiatly.
    After knowing the table where the text values for Position (PLANS) are stored, you have to create a text datasource using RSO2 transaction and replicate in BW and load data from the R/3 table.
    Hope this helps you.
    Regards,
    Saravanan.

  • SQL report region source to call a pl/sql function using DB link

    Hi - I have a pl/sql function fn_dbtype(id NUMBER) defined in database X. The pl/sql function executes couple DML statements and returns a string (a SELECT query). I am able to call this function using SQL Plus (Connected to Database X) as below and it works fine:
    declare
    vSQL VARCHAR2(100);
    begin
    vSQL := fn_dbtype(1);
    end;
    The DML operations completed fine and vSQL contains the "Select" query now.
    In APEX:
    I am trying to create a SQL report in APEX using SQL query(PL/SQL function returning a sql statement) option. I am trying to figure out what to put in the region source so that the output of the "Select" query is displayed in the report.
    Moreover APEX is hosted in a different database instance. So I would need to call this pl/sql function using a DB Link.
    Please let me know what I need to put in the region source to execute the pl/sql function which returns the "Select" query thereby displaying the query output in the report. Thanks.
    Edited by: user709584 on Mar 19, 2009 2:32 PM
    Edited by: user709584 on Mar 19, 2009 2:34 PM

    try something like this:
    return fn_dbtype(1)@dblink;

  • Region source (PL/SQL function body returning SQL query)

    Hi, guys.
    Here is what i try to do:
    Create a region of type SQL Query (PL/SQL function body returning SQL query). In the source area i tried to put this:
    DECLARE
    v_new VARCHAR2(10);
    v_SQL varchar2(32000);
    BEGIN
    v_new := :P102_HDN_NEW;
    -- htp.p(v_new);
    IF v_new = 'N-Set' THEN
    v_SQL := 'select ' ||
    ELSIF v_new = 'Y-Set' THEN
    v_SQL := 'select ' ||
    END IF;
    RETURN v_SQL;
    END;
    And here is the reply from APEX:
    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.
    Now.
    1. Variable is set with the right value.
    2. Each statement (separately) returns SQL that works with no problems
    3. Problem occures if i try to put IF statement around the SQL creation.
    4. If i select "Use Generic Column Names (parse query at runtime only)" instead of "Use Query-Specific Column Names and Validate Query" then the script returns SQL properly, however report's column names are set to Col1, Col2,Col3 ......
    Thnks in advence
    Mike

    OK. Here is enire statement:
    DECLARE
    v_new VARCHAR2(10);
    v_SQL varchar2(32000);
    BEGIN
    v_new := :P102_HDN_NEW;
    htp.p(v_new);
    IF v_new = 'N-Set' THEN
    v_SQL := 'select ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(10,c.sdescr) descr, ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(12,DECODE(ld.level,''All'', ''All Categories'',ld.level)) level, ' ||
    'apex_item.checkbox(1, ld.opt_in_auto_flag, decode(ld.opt_in_auto_flag,NULL,''disabled'',''Y'',''checked'')) auto_in, ' ||
    'apex_item.checkbox(2, ld.opt_in_manual_flag, decode(ld.opt_in_manual_flag,NULL,''disabled'',''Y'',''checked'')) manual_in, ' ||
    'apex_item.checkbox(3, ld.opt_out_auto_flag, decode(ld.opt_out_auto_flag,NULL,''disabled'',''Y'',''checked'')) auto_out, ' ||
    'apex_item.checkbox(4, ld.opt_out_manual_flag, decode(ld.opt_out_manual_flag,NULL,''disabled'',''Y'',''checked'')) manual_out, ' ||
    'DECODE(c.code, ''NMBR'', NULL,''Change to '' || DECODE(ld.level,''All'',''Categories'',''All Categories'')) link_change, ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(11,c.code) code ' ||
    'from ' ||
    'tbl1 c, ' ||
    'tbl2 ld ' ||
    'where c.code = ld.code ' ||
    'and c.type = ''TYPE1'' ' ||
    'and c.active = ''Y'' ' ||
    'order by c.sorting ';
    ELSIF v_new = 'Y-Set' THEN
    v_SQL := 'select ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(10,c.sdescr) descr, ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(12,''All Categories'') level, ' ||
    'apex_item.checkbox(1, c.option_1, decode(c.option_1,NULL,''disabled'',''Y'',''checked'')) auto_in, ' ||
    'apex_item.checkbox(2, c.option_3, decode(c.option_3,NULL,''disabled'',''Y'',''checked'')) manual_in, ' ||
    'apex_item.checkbox(3, c.option_2, decode(c.option_2,NULL,''disabled'',''Y'',''checked'')) auto_out, ' ||
    'apex_item.checkbox(4, c.option_4, decode(c.option_4,NULL,''disabled'',''Y'',''checked'')) manual_out, ' ||
    'DECODE(c.code, ''AAA'', NULL,''Options by AAA'') link_change, ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(11,c.code) code ' ||
    'from ' ||
    'tbl1 c ' ||
    'where 1 = 1 ' ||
    'and c.type = ''TYPE1'' ' ||
    'and c.active = ''Y'' ' ||
    'order by c.sorting ';
    END IF;
    RETURN v_SQL;
    END;
    If i put just this
    DECLARE
    v_new VARCHAR2(10);
    v_SQL varchar2(32000);
    BEGIN
    v_new := :P102_HDN_NEW;
    htp.p(v_new);
    v_SQL := 'select ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(10,c.sdescr) descr, ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(12,DECODE(ld.level,''All'', ''All Categories'',ld.level)) level, ' ||
    'apex_item.checkbox(1, ld.opt_in_auto_flag, decode(ld.opt_in_auto_flag,NULL,''disabled'',''Y'',''checked'')) auto_in, ' ||
    'apex_item.checkbox(2, ld.opt_in_manual_flag, decode(ld.opt_in_manual_flag,NULL,''disabled'',''Y'',''checked'')) manual_in, ' ||
    'apex_item.checkbox(3, ld.opt_out_auto_flag, decode(ld.opt_out_auto_flag,NULL,''disabled'',''Y'',''checked'')) auto_out, ' ||
    'apex_item.checkbox(4, ld.opt_out_manual_flag, decode(ld.opt_out_manual_flag,NULL,''disabled'',''Y'',''checked'')) manual_out, ' ||
    'DECODE(c.code, ''NMBR'', NULL,''Change to '' || DECODE(ld.level,''All'',''Categories'',''All Categories'')) link_change, ' ||
    'APEX_ITEM.DISPLAY_AND_SAVE(11,c.code) code ' ||
    'from ' ||
    'tbl1 c, ' ||
    'tbl2 ld ' ||
    'where c.code = ld.code ' ||
    'and c.type = ''TYPE1'' ' ||
    'and c.active = ''Y'' ' ||
    'order by c.sorting ';
    RETURN v_SQL;
    END;
    it works fune...

Maybe you are looking for

  • Itunes won't detect ipad 2

    I've installed and re-installed the latest itunes 64bit on my win 7 machine. yet itunes will not detect it. I've tried multiple usb cables. tried differnt usb ports yet to no avail. every so often it will detect and let me sync but 99% of the time it

  • Disk needs to be repaired?

    Hi there, I recently did a system check with system utilities on my system drive of my mac pro and it gave me the below error message. I used the the verify disk option in the system utilities. Ok so it tells me how to fix it but my only concern now

  • IN BACKGROUND TASK

    Hi all, howe can I do to use INSERT_COUNT ? R/3 (RFC) --> xi --> (JDBC - Insert) R/3 (RFC) <-- xi <-- (JDBC - Insert.response) I want to know how much registers was inserted in database. I know that must to be used element INSERT_COUNT in the message

  • Can't change external editor. Why?

    I use iPhoto 6.0.3. I have Photoshop installed and was using it as the external editor in iPhoto. I've not bought and installed Photoshop Elements 4 and installed it. If I Control click on a photo in iPhoto, the only option I still have is Photoshop.

  • Doubt on Screen exit

    Hi All, Im working on a screen exit, i need to have some 7 fields in one subscreen and i need to display this subscreen based on EKKO-EKORG,but this value will be given by user in previous screen,how can i fetch this field in my screen exit,coz if i