Storing the values of execute immediate instruction.

Hi all
I execute immediate statement that gets several rows at a time. I need to save this picture and print. Pleas elte the syntax me to use an array or temp table in oracle. See the code provided below.
Thank you...
declare
v_ct varchar2 (290);
v_sqlcode number: = 0;
v_stmt varchar2 (2900);
r_tbl VARCHAR2 (150);
cursor c_tbl is
Select the table TABLE_NAME from DBA_TABLES where OWNER = 'ted '.
Start
Open c_tbl;
loop
extract the c_tbl in r_tbl;
When the output c_tbl % notfound;
v_stmt: = 'select NULLABLE from DBA_TAB_COLUMNS WHERE TABLE_NAME =' | " ' || r_tbl | " ' |' and COLUMN_NAME in (select column_name from DBA_IND_COLUMNS where INDEX_NAME = (select 'INDEX_NAME' from DBA_INDEXES where TABLE_NAME =' | ")) ' || r_tbl | " ((' |' and UNIQUENESS = "UNIQUE"))';
run immediately v_stmt in v_ct;
v_sqlcode: = SQLCODE;
If v_sqlcode = 0
then dbms_output.put_line (v_ct);
end if;
end loop;
close c_tbl;
end;

Your immediate question seems to be answered.

I would like to point out a few problems with your code, however.

First of all, it seems pointless to use dynamic SQL here - you can use a static SQL statement to get the same data. You can use static SQL, you should.

Secondly, if you want to use dynamic SQL statements, you should really use bind variables. Something like

  v_stmt := 'select NULLABLE from DBA_TAB_COLUMNS WHERE TABLE_NAME = :1 and COLUMN_NAME in (select column_name from DBA_IND_COLUMNS where INDEX_NAME= (select "INDEX_NAME" from DBA_INDEXES where TABLE_NAME =':2 and UNIQUENESS =''UNIQUE''))';
  execute immediate v_stmt
      bulk collect into v_ct
    using r_tbl, r_tbl;

Third, your deepest query is to select the literal 'INDEX_NAME' rather than the name of the actual index. Unless you happen to have an index named INDEX_NAME, who is likely to be a mistake.

  v_stmt := 'select NULLABLE from DBA_TAB_COLUMNS WHERE TABLE_NAME = :1 and COLUMN_NAME in (select column_name from DBA_IND_COLUMNS where INDEX_NAME= (select INDEX_NAME from DBA_INDEXES where TABLE_NAME =':2 and UNIQUENESS =''UNIQUE''))';
  execute immediate v_stmt
      bulk collect into v_ct
    using r_tbl, r_tbl;

Fourth, unless you can be sure that the table has a unique index, your query will return an error because the deepest returns multiple lines.

  v_stmt := 'select NULLABLE from DBA_TAB_COLUMNS WHERE TABLE_NAME = :1 and COLUMN_NAME in (select column_name from DBA_IND_COLUMNS where INDEX_NAME in (select INDEX_NAME from DBA_INDEXES where TABLE_NAME =':2 and UNIQUENESS =''UNIQUE''))';
  execute immediate v_stmt
      bulk collect into v_ct
    using r_tbl, r_tbl;

Justin

Published by: Justin Cave on August 5, 2011 23:28

Tags: Database

Similar Questions

  • dml execution 2 statements at a time with the help of execute immediate

    I would like to run 2 DML statements at a time with the help of execute immediate usefulness,.

    ex:

    update employee set ename = 'Chantal' where eno = 123;
    Update dept set dname = 'IT' where dno = 345;

    I want the two statement to execute at a time, but I don't want to use any loop as well.

    Thanks in advance

    You can use:

    execute immediate 'begin update employee set ename='jagadeesh' where eno=123; update dept set dname='IT' where dno=345; end;';
    

    Although updates will always run one after the other.

    If you want the simultaneous treatment, then you need to use DBMS_JOB and DBMS_SCHEDULER to plan both work to run to run each of the statements independently.

  • Storing the value of the click in a variable

    Hello!

    Not a very good programmer, I have this project I'm working on which I create in the edge animate. Here it goes.

    I have a few labels that act as small clips, for example, 'Clip 'Clip 'Clip 'Clip 04' 03' 02' 01'.

    Basically, I have something like a menu bar. If I click on ' Clip 01', the Clip corresponding to he plays, as "" Clip 04' 02', ' Clip 03', buttons play their respective clips. »»

    Here's what I want to do instead, if I click on ' Clip 01', the value of the click event for a click on what could be 1 and 0 for clicked not be stored in a variable. "

    Before "01 Clip' actually starts to play, he must check the value if it is 1 or 0.» If it is 1, while it should play something else he should do nothing.

    The above is just an example of what I'm trying to create. In other words, if I try to explain what I am actually to create or the case, there is really a lot of time explaining from the short example above.

    Thanks in advance

    If you have several buttons here are 2 ways to do it:

    If you can use jquery use this group all your buttons in a div and the Group of call buttons.

    var buttons = sym.$("buttons").children ();

    $.each (buttons, function (i) {})

    $(this) .one ("click", function() {}

    code here

    SYM.$("images"). CSS({"Opacity":0.00});)

    SYM. $("images").animate({"opacity":1.00},700) .attr ('src', ' images / "images [i] +".png"');

    });

    })

    If this is not the case, use this:

    function useButtons (element) {}

    {sym. $(element) .bind ("Click", Function ()}

    This example shows how to change a picture

    SYM.$('image').Attr('src','images/'+element+'.PNG'). CSS({"Opacity":1.00});)

    });

    }

    Add here the names of button

    ["," "," "] .forEach (useButtons);

  • With the help of the POLL with Execute Immediate clause

    I wrote a query to update a table and return the column in a variable of type table nested using the return clause but its not working, I am getting error like

    ORA-06550: line 66, column 22:
    PLS-00306: wrong number or types of arguments in the call to ' |'
    ORA-06550: line 66, column 4:
    PL/SQL: Statement ignored

    I get the error message in part of my request to the suite

    || "RETURN If_row_status in bulk collect INTO"
    || v_if_row_status;


    Referred to as v_if_row_status-
    TYPE v_count IS the TABLE OF varchar2 (50) INDEX directory.
    v_if_row_status v_count;

    The original message listed error about concatenation, but the code in response to scott.wesley had no concatenation. Have you tried to revise the update process? What is a different issue, unrelated to the first?

    The best thing to do would be to create a cursor, loop through it and use a simple update for each row. Updates complex as the one you are trying to use are very difficult to manage. By using a loop to insert/update, you can have control over the process and have access to all values, you must use more later in advance instead of having to use the RETURN clause.

    Insert bulk can be more effective, but is difficult to manage for the great updates.

  • FORALL with EXECUTE IMMEDIATE

    Hi all

    I'm using Oracle 11 g Release2.

    I need to use the forall with EXECUTE IMMEDIATE statement and the content of string inside EXECUTE IMMEDIATE is a SELECT instead of the usual DML statement.

    Objective: In this SELECT statement, I'll be passing of data using the "USING" clause in FORALL statement

    When I try to use it, am getting error found "no DATA".

    Please advice if I use FORALL and EXECUTE IMMEDIATE on a SELECT statement?

    I can share the scenario...

    Thank you!

    >
    Please advice if I use FORALL and EXECUTE IMMEDIATE on a SELECT statement?
    >
    No - you can't. See the specifications of the PL/SQL language
    http://docs.Oracle.com/CD/E14072_01/AppDev.112/e10472/forall_statement.htm
    >
    dml_statement

    An INSERT, UPDATE, or DELETE static or dynamic statement making reference at least a collection in its VALUES or the WHERE clause. Performance benefits apply only to references to the collection that use as an index index_name.

  • EXECUTE IMMEDIATE and multiple SQL

    Hello
    I get a string, say strSQL from an application.
    for example:

    strSQL: = "CREATE UNIQUE INDEX 'WEBDBTARGET'". "" PK_EMPID6"ON"WEBDBTARGET ". "" EMP_R1 "("EMPID")
    PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    TABLESPACE "TARGET_TS_01";

    CREATING INDEX 'WEBDBTARGET '. "' MARK ' ON 'WEBDBTARGET '. "" EMP_R1 "("EMPNAME")
    PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    TABLESPACE «TARGET_TS_01 "«;»

    I tried to run the strSQL using EXECUTE IMMEDIATE

    get the error
    * "PLS-00103: encountered the symbol"end-of-file"when it is waiting for one of the following values: *"
    *; < an ID > < a between double quote delimited identifiers of > *.
    * The symbol ";" was replaced by "end-of-file" continue. » *

    I understand that the question is after the first SQL.
    How to use EXECUTE IMMEDIATE if the input string contains multiple SQL?
    Help, please.

    TIA,
    Newbie

    user570138 wrote:
    strSQL: = "CREATE UNIQUE INDEX 'WEBDBTARGET'". "" PK_EMPID6"ON"WEBDBTARGET ". "" EMP_R1 "("EMPID")
    PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    TABLESPACE "TARGET_TS_01";

    CREATING INDEX 'WEBDBTARGET '. "' MARK ' ON 'WEBDBTARGET '. "" EMP_R1 "("EMPNAME")
    PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    TABLESPACE 'TARGET_TS_01"';'

    You have extra quote (marked in red). But remove won't solve all of your problems. EXECUTE IMMEDIATE executes a SQL statement. You must divide in two strSQL:

    strSQL:=' CREATE UNIQUE INDEX "WEBDBTARGET"."PK_EMPID6" ON "WEBDBTARGET"."EMP_R1" ("EMPID")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "TARGET_TS_01"';
    EXECUTE IMMEDIATE strSQL;
    CREATE INDEX "WEBDBTARGET"."SDSDSD" ON "WEBDBTARGET"."EMP_R1" ("EMPNAME")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "TARGET_TS_01"';
    EXECUTE IMMEDIATE strSQL;
    

    SY.
    P.S. in the majority of cases it IT not a good design of database to create objects dynamically.

  • Execute Immediate is not working well

    We need to find tables with the same name and columns but these columns whose data type is different. The SQL below detects the difference.
    select a.table_name, a.column_name, 
    a.data_type ||'---> '||a.owner BASE_SCHEMA_TYPE, 
    b.data_type ||'---> '||B.owner COMPARED_SCHEMA_TYPE 
    from all_tab_columns a, all_tab_columns b  where a.owner =
    'SCOTT' and b.owner = 'HR'  and a.table_name=b.table_name and
    a.column_name=b.column_name and a.data_type!=b.data_type
    Based on the SQL above, I created the procedure mentioned below which takes a base as input parameter schema and find these tables with the same name but have different data type columns. It generates dynamic SQL code properly (you can see in DBMS_OUTPUT) but for some reason, the INSERT is not the case with EXECUTE IMMEDIATE. No idea why?
    create or replace procedure admin.compare_data_types (p_baseschema in varchar2)
    is
    v_sql   varchar2(2000);
    begin
    
    delete from admin.differences;
    commit;
    
    for rec in (select  username from  dba_users where Username IN ( 'HR'))
    loop
    
      v_sql := 'insert into admin.differences select a.table_name, a.column_name, a.data_type ||''---> ''||a.owner BASE_SCHEMA_TYPE, b.data_type ||''---> ''||B.owner COMPARED_SCHEMA_TYPE from all_tab_columns a, all_tab_columns b      where a.owner = '''||p_baseschema||''' and b.owner = '''||rec.username||'''  and a.table_name=b.table_name and a.column_name=b.column_name and a.data_type!=b.data_type';
         
         dbms_output.put_line (v_sql);
         execute immediate v_sql;
         --commit; -- Doesn't make any difference
         --v_sql := null; -- Doesn't make any difference
         
    
    
    end loop;
    commit;
    
    end compare_data_types;
    Structure of the table being INSERT ed
    create table admin.DIFFERENCES
    (
      TABLE_NAME           VARCHAR2(200),
      COLUMN_NAME          VARCHAR2(200),
      BASE_SCHEMA_TYPE     VARCHAR2(100),
      COMPARED_SCHEMA_TYPE VARCHAR2(100)
    )

    How about putting in a debug message to see what he does...

    (don't forget to ' set serveroutput we "before...)

    create or replace procedure admin.compare_data_types (p_baseschema in varchar2)
    is
    v_sql   varchar2(2000);
    begin
    
    delete from admin.differences;
    commit;
    
    for rec in (select  username from  dba_users where Username IN ( 'HR'))
    loop
    
    insert into admin.differences
    select a.table_name
          ,a.column_name
          ,a.data_type ||'---> '||a.owner BASE_SCHEMA_TYPE
          ,b.data_type ||'---> '||B.owner COMPARED_SCHEMA_TYPE
      from all_tab_columns a
          ,all_tab_columns b
     where a.owner          = p_baseschema  -- Procedure Paramater
       and b.owner          = rec.username
       and a.table_name     = b.table_name
       and a.column_name    = b.column_name
       and a.data_type!=b.data_type;
    
     dbms_output.put_line('Rows Inserted for '||rec.username||': '||sql%rowcount);
    end loop;
    commit;
    
    end compare_data_types;
    

    And see if it is one) enter the loop and b) the number of rows is inserted during the process.

    If it displays 0 rows inserted, then there's something of logically wrong with your select statement, as is return nothing.

  • EXECUTE IMMEDIATE or DBMS_UTILITY. EXEC_DDL_STATEMENT

    Hello

    I recently became aware of DBMS_UTILITY. EXEC_DDL_STATEMENT and I was wondering if it works in pretty much the same way as EXECUTE IMMEDIATE. I'm guessing that EXECUtE IMMEDIATE offers more flexibility when putting together the command you want to run, but you are the only real difference? All opinions accepted with gratitude,

    Kind regards

    Kevin.

    This isn't an exact answer to your question, but it may be useful.

    Execute Immediate is the approach privileged 9i or higher. If you decide which to use, go with EXECUTE IMMEDIATE. You never know when the other dynamic SQL methods will be deprecated. In addition, EXECUTE IMMEDIATE has also been optimized (and will continue to be optimized), so you can usually expect better performance during use.

    The exact differences between EXECUTE IMMEDIATE and DBMS_UTILITY. EXEC_DDL_STATEMENT go, I can't give you an exact answer. (Also the fact that DBMS_UTILITY. EXEC_DDL_STATEMENT DDL is, of course).

    You may or may not find this article helpful: http://okjsp.pe.kr/seq/9789. He did a good job to compare the differences between EXECUTE IMMEDIATE and another way inherited to the dynamic SQL statements (DBMS_SQL. RUN)

    Bob

  • How to keep the value of Session in OBIEE

    I have an obligation to transmit the session of a page variable to the next page in the dashboard.

    Requirement :

    In the part of the presentation:

    Prompt: Column1: year
    Column2: quarter

    I have to pass the selected value in the fast control panel to the repository. To achieve this, I've stored the value of year and quarter column in 2 request variables from the prompt.

    Request Variable1: VarYear stores the value selected year
    Request Variable2: VarQuarter stores quarter selected value

    In the part of the repository:

    1. I created session variables 02 repository with the same name as: VarYear and VarQuarter
    2. under the Block Intitialization of two Variables, I wrote a dummy query as
    ' SELECT PER_NAME_ENT_YEAR FROM W_DAY_D WHERE PER_NAME_ENT_QTR IS NOT
    NULL'
    3. checked the box for "Allow any user set the value" for two session variables.
    4 using the session variable to transmit as a filter on the tab content measurement of the LTS of income as follows:

    «"Oracle Data Warehouse".» Catalog.dbo.Dim_W_DAY_D.PER_NAME_ENT_YEAR = VALUEOF (NQ_SESSION. ("' VarYear") AND "Oracle Data Warehouse. Catalog.dbo.Dim_W_DAY_D.PER_NAME_ENT_QTR = VALUEOF (NQ_SESSION. ("' VarQuarter ')'


    Resolution: The session from the prompt variables is pass correctly to the RPD and returning the result as expected for the current page (invites the two and the report are in the same page where I used the measure of income which is getting filtered in the LTS on the basis of the quarter and the year to the title of the content tab).


    Reuirement2 question:

    I have to navigate from one page to another when the click on the value of the income measure. The target page also contains the same measure of income as in first page. But on the navigation from one page to another page, the session value is getting lost and passing the default value from the block of initialization of the Session instead of the selected value in the command prompt.


    According to my understanding of that session value shouldn't be replaced up to a disconnection from the user of the application. But in my case for the first page where I times Promt and measure revenues the prompt value is pass correctly but when I move to the second page where I only the income measure session value which is already defined at the beginning is replaced with the result of query Session IB.


    Please suggest me if there is no resolution to my problem.

    Thank you very much in advance.
    :)

    I had this problem myself, and here is what I found. The only way I could make it work was to have guests who populate the Session Variables on the pages. In other words if I got the prompt on one page and then used guided navigation to go to another page of dashboard I needed to have the same guests located on this page for session values get passed in. Since in my case I didn't want the guests to view it or the user to know that I had to add the dashboard invites you to capture of Session Variable values, I placed the guests of dashboard for my Session Variables in a separate section and then hid this user story. I hid the section by selecting Properties - Style (HTML only) custom CSS Options and then clicked the box to tick to use Custom CSS Style. In the text box type display: none which will cause the section to hide from the user. Guests will then exist on the dashboard page to receive the session values and the user will never know it's there.

    Hope this helps.

    Eric
    http://www.BIConsultingGroup.com

  • Pass Pl/sql table in the USING clause in the EXECUTE IMMEDIATE statement

    Getting error when I try to pass the PL/SQL table in the USING clause in the EXECUTE IMMEDIATE statement:

    Declare
    result NUMBER;
    TYPE values_tab IS TABLE OF NUMBER INDEX OF directory;
    lv_tab values_tab;
    lv_exp varchar2 (300);
    lv_exec varchar2 (300);
    BEGIN
    lv_tab (1): = 5;
    lv_tab (2): = 48;
    lv_tab (3): = 7;
    lv_tab (4): = 6;
    lv_exp: = ': + b1: b2 + (: b3 *: b4)';
    lv_exec: = 'SELECT'. lv_exp | ' THE DOUBLE '.

    IMMEDIATE EXECUTION
    lv_exec
    IN
    result
    USING
    lv_tab;
    DBMS_OUTPUT. Put_line (result);

    END;
    /

    Error on line 1
    ORA-06550: line 20, column 12:
    PLS-00457: expressions must be SQL types
    ORA-06550: line 15, column 8:
    PL/SQL: Statement ignored


    I am trying to evaluate the expression ': + b1: b2 + (: b3 *: b4) "which is stored in the table. This table has different expressions (expressions about 300). I want to use the bind variable in the expression because each expression evaluated thousands of time may be more in some cases. If I use bind variable can he fill pool.

    Is there a way I can pass parameters with the HELP of (IN) dynamically instead of write "help lv_tab (1), lv_tab (2), lv_tab (3), lv_tab (4)? As number of change of the input parameters depend on the expression in the table.

    If it is possible please suggest any other ideas/approaches

    Help, please...

    Published by: satnam on June 11, 2009 11:50

    Well, you keep changing faster reqs that I can follow. In any case, assuming that N-th variable bind (left to right) corresponds to n-th collection item:

    Declare
        result NUMBER;
        lv_tab values_tab := values_tab();
        lv_exp varchar2(300);
        lv_exec varchar2(300);
        lv_i number := 0;
    BEGIN
        lv_tab.extend(4);
        lv_tab(1) := 5;
        lv_tab(2) := 48;
        lv_tab(3) := 7;
        lv_tab(4) := 6;
        lv_exp := ':5000135+:5403456+(:5900111*:5200456)';
        lv_exec := lv_exp;
        While regexp_like(lv_exec,':\d+') loop
          lv_i := lv_i + 1;
          lv_exec := REGEXP_REPLACE(lv_exec,':\d+',':b(' || lv_i || ')',1,1);
        end loop;
        lv_exec := 'BEGIN :a := ' || lv_exec || '; END;';
    DBMS_OUTPUT.PUT_LINE(lv_exec);
    EXECUTE IMMEDIATE lv_exec USING OUT result,IN lv_tab;
    DBMS_OUTPUT.PUT_LINE(result);
    END;
    /
    BEGIN :a := :b(1)+:b(2)+(:b(3)*:b(4)); END;
    95
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • Lovs cascading in a table, see the stored default value

    Hi all.

    I use 5 APEX.

    I need to create a Select list based on another inside a tabular presentation, I have followed this thread: How to make the selection list cascading in the form of? and when I add a new line it works OK, the problem is once I have save changes, if I have access to the tabular presentation page again every row shows 'Selection' - and the value that is stored in the database is not shown by default, the list is built according to the LOV parent for existing lines, but will return to the Mode "selection", that vary according to the initial behavior in the form of tables.

    Please help me to show the stored value for the lines already stored.

    Thanks in advance, best regards.

    Hi all.

    The problem is in the definition of the child selection list, I changed the "display additional values" field to YES and now it works perfectly.

    Concerning

  • How can I force DAC to run always full load for one of the task that executes the stored procedure? And remaining tasks load incremental in the second and sub sequent executions.

    Hello

    How can I force DAC to run always full load for one of the task that executes the stored procedure? And remaining tasks load incremental in the second and sub sequent executions.

    Thank you

    Jay.

    Hi if your task is running an informatica mapping you can set your DAC task to run the full mapping for incremental and full loads, so tab task just point to the mapping.

    Hope that helps.

    Thank you

  • To access the values stored in the configuration item

    I change a series of workflow that uses the values stored in a table within a configuration item. The item is shared between several workflow, with being initially populated via an online form. I want to add an additional field to the user interface that will be used in workflows to other institutions.

    The workflow that fills the element, I can fill and access the values of the Interior, no problem. I can export and see the values being stored in the element. When I try and access it in another stream of work, the values appear to be blank.

    I guess I wonder how workflows would share these values are the values in the table consulted positiionally? Other that the key defined for the single value, i.e. name, they don't seem to have a unique identitier. I enclose a small snippet of the content of the element below. Thank you.

    #string #test # #string #test # # string; string # #; #Date #20130501180811-0400 #; #string #cluster - 1 #; Array # # {#} #; #string #05012013 #;

    Yes, table ellements are accessible by position / via the index.

    What values appear empty in the workflow one another? All the values stored in the configuration item, or only the extra value you add? In your statement, it seems to be an empty array (after the string "cluster-1" ').

    If possible, could prepare you a couple of sample workflows (one that fills the configuration item) and those who read it, that demonstrates the problem?

    -Ilian

  • Restore the inputText mandatory and immediate value.

    Hello, Jdeveloper, Version 11.1.2.1.0
      <af:inputText value="#{row.bindings.Name.inputValue}" required="true" id="it7" immediate="true" autoSubmit="true"/>
    
     <af:commandLink id="clact2" action="#{adminGroupManagementBean.cancel}"  partialSubmit="true" immediate="true">
    My inputText is necessary because I'm not supposed to introduce null values to it.
    My inputText is immediate = true because I need to restore the new value of it when I press the Cancel button.
    My Undo button is immediate = true because I need to be able to restore, if the value for the inputText is empty.
    The problem is that if the user deletes the old value of inputText (it is immediate) and the new value is "null", when I press the button cancel he says value inputText is required and the user must enter a value to be able to restore the old values.
        public void groupNameChangeListener(ValueChangeEvent valueChangeEvent) {
            if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().toString().length() > 0) {
                // valueChangeEvent.getNewValue()  Is not null I can do what I want here
            } else {
               
    
                 //I never can get into this else because the inputText has required = true
                //Any way that I can access it?
    
    
            }
        }

    Discover http://tompeez.wordpress.com/2012/03/11/jdeveloper-adf-rest-form-fields/...

    What exactly does the action #{adminGroupManagementBean.cancel} not? A restoration of db?

    My inputText is immediate = true because I need to restore the new value of it when I press the Cancel button.

    It should work when only the button cancel value immediate = "true". Anyway, your inputText is positioned at autoSubmit = "true" the only chance to get the old value back is to a cancellation of the db. A normal reset does not work after you have submitted values.

    Timo

  • The concatenation of the EXECUTE IMMEDIATE statement.

    Hi all

    The situation is that I am trying to find all customers whose Date of birth (DOB) is greater than or equal to 150 days. Unfortunately, when I run this SQL I get the error message:
    (1) ORA-00904: "FEB": invalid identifier
    (1) ORA-06512: at line 4 level

    I'm not sure what I should do to solve this problem, I hope you can help.

    Note: I have to encapsulate this statement in an immediate execution due to problems of roles/Privilidge. In the full version, I also use AUTHID CURRENT_USER.


    DECLARE
        curr_date Date := SYSDATE;
    BEGIN
        EXECUTE IMMEDIATE ' SELECT  cust_name,
                                    cust_dob, -- date of birth
                                    cust_shoe_size
                            FROM    tblCustDetails c
                            WHERE   SUBSTR(c.cust_name, 1,7) = ''Bob''
                                    AND cust_dob >= NEXT_DAY(' || curr_date ||' - 150 , ''SATURDAY'')
                             ';
    END;
    Edited by: DaveyB February 23, 2012 08:39

    The right way to use dynamic queries like this would get stuck in the variables you use... for example

    DECLARE
        curr_date Date := SYSDATE;
    BEGIN
        EXECUTE IMMEDIATE ' SELECT  cust_name,
                                    cust_dob, -- date of birth
                                    cust_shoe_size
                            FROM    tblCustDetails c
                            WHERE   SUBSTR(c.cust_name, 1,7) = ''Bob''
                                    AND cust_dob >= NEXT_DAY(:1 - 150 , ''SATURDAY'')
                             ' USING curr_date;
    END;
    

    However, you also have to take into account the fact that the results of the query are currently disappearing into the ether, so you need an INTO statement...

    DECLARE
        curr_date Date := SYSDATE;
    BEGIN
        EXECUTE IMMEDIATE ' SELECT  cust_name,
                                    cust_dob, -- date of birth
                                    cust_shoe_size
                            FROM    tblCustDetails c
                            WHERE   SUBSTR(c.cust_name, 1,7) = ''Bob''
                                    AND cust_dob >= NEXT_DAY(:1 - 150 , ''SATURDAY'')
                             ' INTO var1, var2, var3 USING curr_date;
    END;
    

    ensure that your variables are declared as appropriate, and then...

    ... you have to take into account the possibility that there is more than 1 line returned, in which case you will have the results of the query to a collection.

    Of course, it is useless for dynamic SQL statements in the first place...

    DECLARE
        curr_date Date := SYSDATE;
    BEGIN
      SELECT  cust_name,
              cust_dob, -- date of birth
              cust_shoe_size
      INTO    var1, var2, var3
      FROM    tblCustDetails c
      WHERE   SUBSTR(c.cust_name, 1,7) = 'Bob'
      AND     cust_dob >= NEXT_DAY(curr_date - 150 , 'SATURDAY');
    END;
    

    still, you should always take into account the bulk collection in a collection if it were going to be more than one row returned.

Maybe you are looking for