Using Sequence in FORALL Statement

I'm using a package to get the nextval in a sequence object. Basically, it is a function that returns select user_seq.nextval from dual.
But I get 'column not allowed here' error. PL/SQL: ORA-00984: column not allowed here
OPEN users_ins ;
             LOOP
                FETCH         naf_users_ins
                BULK COLLECT
                INTO           arr_person_key
                             , arr_person_id
                             , arr_first_name
                             , arr_middle_name
                             , arr_last_name
                             , arr_username
                             , arr_user_status_seq
                             , arr_creation_date
                             , arr_comments
               LIMIT         100 ;
FORALL idx IN 1 ..  arr_person_key.COUNT
                 SAVE EXCEPTIONS
                   INSERT INTO users
                    (   user_seq
                      , person_key
                      , person_id
                      , first_name
                      , middle_name
                      , last_name
                      , username
                      , user_status_seq
                      , creation_date
                      , comments
                    VALUES  (   *pkg_admin.get_nextval*
                              , arr_person_key(idx)
                              , arr_person_id(idx)
                              , arr_first_name(idx)
                              , arr_middle_name(idx)
                              , arr_last_name(idx)
                              , arr_username(idx)
                              , arr_user_status_seq(idx)
                              , arr_creation_date(idx)
                              , arr_comments(idx)
EXIT WHEN users_ins%NOTFOUND ;
             END LOOP ;
             CLOSE users_ins;
c/code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Hi,
I've recently completed a similar task, but I declared a collection with the rowtype of the table. I also added the sequence in the query of my cursor. Take a look at the following example.
CREATE OR REPLACE PROCEDURE Insert_OR_ExternalService
IS
TYPE externalService_tbl IS TABLE OF OR_ExternalService%ROWTYPE;
externalService externalService_tbl;
CURSOR OR_ExternalServiceCursor
IS
select
SEQ_ID.NEXTVAL as "Id",
column as "ExternalId",
column as "ExternalSystem",
from table1
where ...;
BEGIN
OPEN OR_ExternalServiceCursor;
LOOP
FETCH OR_ExternalServiceCursor BULK COLLECT INTO externalService LIMIT 1000;
FORALL i IN 1 .. externalService.count
INSERT INTO OR_ExternalService values externalService(i);
COMMIT;
EXIT WHEN OR_ExternalServiceCursor%NOTFOUND;
END LOOP;
CLOSE OR_ExternalServiceCursor;
END;

Similar Messages

  • Update query using FORALL statement

    Hi ALL,
    I have two tables Table: Mater_A(20 Cloumns) and Temp_A(20 Columns).
    Both are almost identical. The Master_A is master table that has to be updated daily based on the temporary table Temp_A.
    Everyday , i expect around 100000 records(same records with modified valus ) in Temp_A that has to be updated in Master_A. So i have to make the query as optimized as possible.
    For this,I have created a cursor that has all records from table Temp_A.
    Then i am using FORALL statement to update the data. But it throws exception something like that:
    Error: PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND table of records
    Error: PLS-00382: expression is of wrong type
    It states that i have to create a separate type for each column that i want to update.
    I have created procedure like this:
    Open C_Temp_A;
    Loop
    Fetch C_Temp_A Bulk Collect into v_C_Temp_A limit 5000;
    Exit When C_Temp_A%NOTFOUND;
    Begin
    ForAll i in v_C_Temp_A.first.. v_C_Temp_A.Last
    Update Master_A mst Set mst.Column2= v_C_Temp_A(i).t_Column2,
    mst.Column3= v_C_Temp_A(i).t_Column3,mst.Column4= v_C_Temp_A(i).t_Column4........to all columns
    where mst.Column1= v_C_Temp_A(i).t_Column1;
    End;
    End Loop;
    Close C_Temp_A;
    Please help me to solve this or suggest me any other alternative to reduce the processing time.

    Why cant you use like :(Or I misread?)
    SQL> select * from a;
            ID         C2
             1        100
    SQL> select * from b;
            ID         C2
             1       1000
    SQL> merge into b
      2  using(select * from a) a
      3  on (b.id = a.id)
      4  when matched then
      5   update
      6   set b.c2 = a.c2;
    1 row merged.
    SQL> select * from b;
            ID         C2
             1        100                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can we use dbms_output.put_line package with forall statement

    Hello Everybody
    Can we use dbms_output.put_line package with forall or can we use insert,update and delete only
    declare
    type emp_rec is table of emp%rowtype
    index by binary_integer;
    t emp_rec;
    begin
    select * bulk collect into t from emp;
    forall i in t.first..t.last
    dbms_output.put_line(t(i).name);
    end;Thanks & Regards
    peeyush
    Edited by: Peeyush on Nov 25, 2010 11:45 PM

    MichaelS wrote:
    Well as the docs explain (though not very clear and detailed, I admit) you can use a dynamic sql statement (execute immediate) with FORALL.You got me interested in the performance side doing this Michael - running PL/SQL code via a FORALL loop.
    It is faster than using a normal FOR loop to execute dynamic PL/SQL - a bit surprising as I expected another context switch to be in there. But seems like the PL/SQL engine is a more clever at optimisation than what I originally credited it with.. ;-)
    Of course - pre-compiled/static PL/SQL code in a FOR loop is the fastest, as expected.
    SQL> declare
      2          type TNumbers is table of number;
      3 
      4          type TTimes is record(
      5                  for_all number,
      6                  for_dynamic number,
      7                  for_static number
      8          );
      9 
    10          type TTimesTable is table of TTimes;
    11 
    12          MAX_ITERATIONS  constant number := 10;
    13 
    14          plBlock         varchar2(1000) :=
    15          'declare i number;
    16          begin i:= :var / 10; end;';
    17 
    18          performance     TTimesTable;
    19          t1              number;
    20          bindVar         TNumbers;
    21          n               number;
    22  begin
    23          select
    24                  level bulk collect into bindVar
    25          from    dual
    26          connect by level <= 10000;
    27 
    28          dbms_output.put_line( 'Iterations: '||bindVar.Count||' for loop cycle(s)' );
    29 
    30          performance := new TTimesTable();
    31          performance.Extend( MAX_ITERATIONS );
    32 
    33          for j in 1..MAX_ITERATIONS
    34          loop
    35                  t1 := dbms_utility.get_time;
    36                  forall i in 1..bindVar.Count
    37                          execute immediate plBlock using bindVar(i);
    38                  performance(j).for_all := dbms_utility.get_time-t1;
    39 
    40                  t1 := dbms_utility.get_time;
    41                  for i in 1..bindVar.Count
    42                  loop
    43                          execute immediate plBlock using bindVar(i);
    44                  end loop;
    45                  performance(j).for_dynamic := dbms_utility.get_time-t1;
    46 
    47                  t1 := dbms_utility.get_time;
    48                  for i in 1..bindVar.Count
    49                  loop
    50                          n := bindVar(i) / 10;
    51                  end loop;
    52                  performance(j).for_static := dbms_utility.get_time-t1;
    53          end loop;
    54 
    55          dbms_output.put_line( 'Times in 100th of a second' );
    56          dbms_output.put_line( rpad('for all',15) || rpad('for dynamic',15) || rpad('for static',15) );
    57          for i in 1..performance.Count
    58          loop
    59                  dbms_output.put_line(
    60                          rpad( performance(i).for_all, 15 )||' '||
    61                          rpad( performance(i).for_dynamic, 15 )||' '||
    62                          rpad( performance(i).for_static, 15)
    63                  );
    64          end loop;
    65 
    66  end;
    67  /
    Iterations: 10000 for loop cycle(s)
    Times in 100th of a second
    for all        for dynamic    for static
    10              72              0
    6               37              0
    6               37              0
    6               37              0
    6               36              0
    6               37              1
    5               37              0
    5               37              0
    6               37              1
    5               37              0
    PL/SQL procedure successfully completed.
    SQL>

  • BULKING and FORALL statement does not pass values to non DML statements.

    Hi
    I've got million rows that i need to manapulate and insert into various procedures depending on the bussiness rule to be applied, but my dilemma is that the BULIKNG with a combination of a FORALL statement its not compatible(only considers straightforward DML calls) or the the FORALL does not like other SQL statements or calls as it prefers only DML's.
    Below is code fragment that is problamatic as the compiler keeps sending me this error: PLS-00201: identifier 'INDX' must be declared
    I want to manupulate data on the implicity cursor and call a procedure to do other stuff which don't use INSERT/DELETE or UPDATE statements.
    Declare
    TYPE tab_person_id is of table of number(15);
    l_person_id tab_person_id;
    BEGIN
    SELECT person_id
    BULK COLLECT INTO l_person_id
    FROM person_details; /*-Million records-*/
    FORALL indx IN l_tdtl.FIRST..l_tdtl.LAST
    pj_pkg.ins_intf
    (p_user => p_user,
    p_typ_cd => '00',
    p_person_id => l_person(indx)
    Commit;
    END;
    How do I pass this value 'l_person(indx)' on the package procudure ?
    Thanks
    Amos

    @prabodh:
    SQL> declare
      2  TYPE tab_person_id is of table of number(15) index by pls_integer;
      3  begin
      4  null;
      5  end;
      6  /
    TYPE tab_person_id is of table of number(15) index by pls_integer;
    ERROR at line 2:
    ORA-06550: line 2, column 23:
    PLS-00103: Encountered the symbol "OF" when expecting one of the following:
    ( array limited new private range record VARRAY_ char_base
    number_base decimal date_base clob_base blob_base bfile_base
    table ref object fixed varying opaque sparse
    The symbol "OF" was ignored.Check What you are posting.
    @ qwestion: What is your Database Version? It is a implementation restriction.

  • How can I run two DML in one FORALL statement?

    How can I run 1) select 2) update in one FORALL for each item as below?
    OPEN FXCUR;
      LOOP
            FETCH FXCUR BULK COLLECT INTO v_ims_trde_oids LIMIT 1000;
            EXIT  WHEN v_ims_trde_oids.COUNT() = 0;
         FORALL i IN v_ims_trde_oids.FIRST .. v_ims_trde_oids.LAST     
              SELECT EXTRACTVALUE(XMLTYPE(CNTNT),'/InboundGTMXML/ProcessingIndicators/ClientCLSEligibleIndicator')        INTO v_cls_ind
              FROM IMS_TOMS_MSGE  WHERE ims_trde_oid = v_ims_trde_oids(i);
             IF v_cls_ind      IS NOT NULL THEN
                      v_cls_ind       := '~2136|S|'||v_cls_ind||'|';
             UPDATE ims_alctn_hstry  SET CHNGE_DATA_1   =concat(CHNGE_DATA_1,v_cls_ind)
             WHERE ims_trde_hstry_id = (select max(ims_trde_hstry_id) from ims_alctn_hstry where ims_trde_oid=v_ims_trde_oids(i));
             DBMS_OUTPUT.PUT_LINE('Trade oid: '||v_ims_trde_oids(i)||'   CLS Eligible Indicator: '||v_cls_ind);
          END IF;
      END LOOP;
      CLOSE FXCUR;Your help will be appreciated.
    Thanks
    Edited by: PhoenixBai on Aug 6, 2010 6:05 PM

    I came through this forum while googling on the issue of 'using two DML's in one FORALL statement.
    Thanks for all the useful information guys.
    I need to extend this functionality a bit.
    My present scenario is as follows:
    FOR I in 1..collection1.count Loop
         BEGIN
              insert into tab1(col1)
              values collection1(I) ;
         EXCEPTION
              WHEN OTHERS THEN
              RAISE_APPLICATION_ERROR('ERROR AT'||collection1(I));
         END;
         BEGIN
              UPDATE tab2
              SET col1 = collection1(I);
         EXCEPTION
              WHEN OTHERS THEN
              RAISE_APPLICATION_ERROR('ERROR AT'||collection1(I));
         END;
    commit;
    END LOOP;
    I need to use the FORALL functionality in this scenario, but without using the SAVE EXCEPTIONS clause keeping in mind that I also need to get value in the
    collection that led to the error.Also, the each INSERT statement has to be followed by an UPDATE and then the cycle goes on(Hence I cannot use 2 FORALL statements for INSERT and UPDATE coz then all the INSERT will be performed at once and similarly the UPDATEs). So I created something like this:
    DECLARE
    l_stmt varchar2(1000);
    BEGIN
    l_stmt := 'BEGIN '||
              'insert into tab1(col1) '||
              'values collection1(I) ; '||
         'EXCEPTION '||
              'WHEN OTHERS THEN '||
              'RAISE_APPLICATION_ERROR(''ERROR AT''|| :1); '||
         'END; '||
         'BEGIN '||
              'UPDATE tab2 '||
              'SET col1 = :1; '||
         'EXCEPTION '||
              'WHEN OTHERS THEN '||
              'RAISE_APPLICATION_ERROR(''ERROR AT''|| :1); '||
         'END;'
    FORALL I in 1..collection1.count
    EXECUTE IMMEDIATE l_stmt USING Collection1(SQL%BULK_EXCEPTIONS(1).ERROR_INDEX);
    END;
    Will this approach work? Or is there any better aproach to this? I am trying to avoid the traditional FOR ..LOOP to achieve better performance of query

  • USING SEQUENCE IN PACKAGE SPEC

    I Want to Use Sequence.NEXTVAL & Sequence.CURRVAL throughout the package. How can i declare the global sequence variable and make them available for all the stored procedures inside the package ?
    Any help highly appreciated..
    Thank you all in advance

    Data Boy wrote:
    No i know that but using directly SEQUENCE.CURRVAL inside the Insert statement is not a good practice.
    We need to declare inside the procedure a variable and then fetch the SEQUENCE.CURRVAL into that variable
    and use that variable inside the insert statement. But we that variable scope will be available only inside that procedure.
    if i want the same CURRVAL in another stored procedure. How can i get it ..that is my Question.What exactly are you trying to achieve?
    If it's a case of needing to know the value of the sequence number assigned to an inserted record you would typically use the RETURNING clause on the insert statement...
    SQL> create table temp (id number, val varchar2(20));
    Table created.
    SQL> create sequence temp_seq;
    Sequence created.
    SQL> ed
    Wrote file afiedt.buf
      1  create trigger trg_temp before insert on temp
      2  for each row
      3  begin
      4    select temp_seq.nextval into :new.id from dual;
      5* end;
    SQL> /
    Trigger created.
    SQL> set serverout on
    SQL> declare
      2    v_num number;
      3  begin
      4    insert into temp (val) values ('Fred') returning id into v_num;
      5    dbms_output.put_line('ID inserted was: '||to_char(v_num));
      6  end;
      7  /
    ID inserted was: 1
    PL/SQL procedure successfully completed.
    SQL> select * from temp;
            ID VAL
             1 Fred
    SQL>

  • How to use sequence in MS sql server?

    In Oracle DB we use sequence like that:
    SequenceImpl s = new SequenceImpl("customer_seq", getDBTransaction());
    Integer next = (Integer)s.getData();
    setId(new Number(next.intValue()));
    But there is no sequence in sql server ,how can I do?
    Thank you~~

    MS SQLServer have a IDENTITY column property and UNIQUEIDENTIFIER data type that is somewhat similar to Oracle's sequence. I don't know whether your table contain either of these, or you just want to set sequential number to a column.
    Below is some info about IDENTITY and UNIQUEIDENTIFIER you may already know since they are in SQLServer Book.
    IDENTITY property: You can define IDENTITY property on a numeric column. You can set the seed and increment on this column property very much like Oracle's sequence. The only thing I think it does not have is the "nextval". You can use IDENT_CURRENT function or @@IDENTITY after an INSERT or SELECT INTO to get the last value generated. Of course you can use this value and add the increment to get the next
    value but it not the same as seqname.nextval which keep incrementing each time you call it. Getting the current identity value and adding the increment your self will not work for multiple sessions with pending
    insert. Another thing about column with IDENTITY property is that you cannot insert value into this column (i.e, omit it in your insert statement values) unless IDENTITY_INSERT is on, but only one table in a
    session can have IDENTITY_INSERT to be turned on.
    If you don't need to know the next seq value, then IDENTITY work similar to Oracle sequence. Execute select after postchanges or commit will have system generated values. If you need to get next value before insert, Sung suggest using SEQ_TABLE and managing the next value (write a database function to mimic Oracle'
    s nextval).
    UNIQUEIDENTIFIER datatype: UNIQUEIDENTIFIER is a 16-byte hexadecimal number indicating a globally unique identifier (GUID). The GUID is useful when a row must be unique among many other rows. You could use NEWID() to create a value of type uniqueidentifier or calling some API function that returns a GUID. The advantage of using uniqueidentifier is that the values generated by NEWID function or application GUID are guaranteed to be unique throughout the world. The disadvantage of using uniqueidetifier is that it is long and obscure, random, difficult for user to remember or type correctly. It is 16 byte, which is large compare to other datatype such as 4-byte integer.
    Thanks,
    Yvonne

  • What is the use of at new statement?

    What is the use of at new statement?

    Hi,
    AT - itab
    Syntax
    LOOP AT itab result ...
      [AT FIRST.
       ENDAT.]
        [AT NEW comp1.
         ENDAT.
           [AT NEW comp2.
           ENDAT.
           AT END OF comp2.
           ENDAT.]
         AT END OF comp1.
         ENDAT.]
      [AT LAST.
      ENDAT.]
    ENDLOOP.
    Extras:
    1. ...  FIRST
    2. ... |{END OF} compi
    3. ...  LAST
    Effect
    The statement block of a LOOP loop can contain control structures for control level processing. The respective control statement is AT. The statements AT and ENDAT define statement blocks that are executed at control breaks, that is, when the control structure is changed. The additions to the AT statements determine the control break at which their statement blocks are executed. Within these statement blocks, the statement SUM can be specified to add together the numeric components of a control level. For the output behavior result, the same applies as for LOOP AT.
    The prerequisite for control level processing is that the internal table is sorted in exactly the same sequence as the component of its line type - that is, first in accordance with the first component, then in accordance with the second component, and so on. The line structure and the corresponding sorting sequence gives a group structure of the content of the internal table, whose levels can be evaluated using AT statements. The AT- ENDAT control structures must be aligned one after the other, in accordance with the group structure.
    The statement blocks within the AT- ENDAT control structures are listed if an appropriate control break is made in the current table line. Statements in the LOOP- ENDLOOP control structure that are not executed within an AT- ENDAT control structure are executed in each pass of the loop.
    In order that control level processing is carried out properly, the following rules must be observed:
    After LOOP, a restricting condition cond can only be specified if this selects a consecutive line block of the internal table. Otherwise, the behavior of control level processing is undefined.
    The internal table cannot be modified within the LOOP loop.
    A work area wa specified in the LOOP statement after the addition INTO must be compatible with the line type of the table.
    The content of a work area wa specified after the addition INTO in the LOOP statement must not be modified.
    If the INTO addition is used in the LOOP statement to assign the content of the current line to a work area wa, its content is changed upon entry into the AT-ENDAT control structure as follows:
    The components of the current control key remain unchanged.
    All components with a character-type, flat data type to the right of the current control key are set to character "*" in every position.
    All the other components to the right of the current control key are set to their initial value.
    When the AT-ENDAT control structure is exited, the content of the current table line is assigned to the entire work area wa.
    Addition 1
    ... FIRST
    Effect
    The control level is defined by the first line of the internal table. The control break takes place when this line is read.
    Note
    In the group level AT FIRST, the current group key contains no components and all character-type components of the work area wa are filled with "*" and all remaining components are set to their initial value.
    Addition 2
    ... |{END OF} compi/>
    Effect
    : Control levels are defined by the beginning or end of a group of lines with the same content in the component compi (where i = 1, 2, and so on) and in the components to the left of compi. The control breaks take place when the content of the component compi or another component to the left of compi changes.
    The compi components can be specified as described in Specification of Components, with the limitation that access to object attributes is not possible here.
    Note
    If the INTO or ASSIGNING additions are used in the LOOP statement, a field symbol can be entered after AT |{END OF} outside classes, to which the corresponding component of the work area wa or the field symbol <fs> is assigned. This form of dynamic component specification is obsolete and has been replaced by specification in the format (name).
    Addition 3
    ... LAST
    Effect
    : The control level is defined by the last line of the internal table. The control break takes place when this line is read.
    Note
    In the group level AT LAST, the current group key contains no components and all character-type components of the work area wa are filled with "*" and all remaining components are set to their initial value.
    Regards,
    Prashant

  • How to set default value of a table using sequence number

    Dear all,
    Does any body know that how to set default value of a table
    using sequence number.
    But I don't want to use trigger to do that.
    Please help!!!!
    Eldon

    Andrew is essentially correct. You can get around the trigger,
    but not the sequence, if (and this may be a very big if) you can
    guarantee that every time an insert is done into the table, from
    whatever source, the statement looks something like
    INSERT INTO tbl VALUES (sequence.nextval,other_columns_values)

  • How to increment the date using sequence?

    how to increment the date using sequence?
    01-jan-10
    02-jan-10
    30-jan-10

    794244 wrote:
    how to increment the date using sequence?
    01-jan-10
    02-jan-10
    30-jan-10This doesn't look like a task where a sequence is usefull.
    A sequence is a number generator that guarantees that multiple sessions will all get a different number.
    Even if the sequence is fetched for differnent users (=sessions) that the same time.
    This in turn means that the value returned by the sequence will depend on actions done in other sessions.
    Typical task: create a new unique primary key number. The number MUST be different in all sessions.
    In your case I guess that the same logic should work regardless of the session that executes it. So you need a "number generator" that works indepented from other session values. There are several ways to create such a numbered list.
    The basic idea is to create a select statement that simply returns as many rows as you need. And then use ROWNUM as the number generator. Examples how to do this have already been given. LEVEL works also in hierarchical queries.
    if my interpretation of your requirement is right, then all answers that really used a sequence seem to be wrong. Even if the output looks ok. At best they are just slow. To create new sequence values is a complex task and the database needs a little time for all the synchonization issues that come with it. At worst it will have gaps in the sequence because other sessions used the same value while the numbers were created.
    Edited by: Sven W. on Sep 20, 2010 2:08 PM

  • Use of LINE OF statement

    Hi all,
    what is the use of LINE OF statement?
    DATA:       itab_iv_item TYPE TABLE OF   bapi_incinv_create_item,
                     itab_return TYPE TABLE OF bapiret2.
    DATA:       wa_iv_item LIKE LINE OF itab_iv_item,
                     wa_return LIKE LINE OF itab_return.
    what these statements do
    DATA:       wa_iv_item LIKE LINE OF itab_iv_item,
                     wa_return LIKE LINE OF itab_return.
    Thanks in advance
    krupali.

    Hi KR.,
    1.
    types: begin of st1,
              <fields>
              end of st1.
    data: wa type st1.
    Here we are declaring the wa by using the syntax TYPE. because here we know the structre.
    2.
    data: wa type vbak.
    Here we are declaring the wa wrt Database Table so here we can use TYPE syntax again.
    3.
    data: begin of itab occurs 0,
                <fields>
                end of itab.
        data: wa like line of itab.
    Here we are declaring the wa wrt internal table which is having header line and body, so we can't use TYPE here, we must go for LIKE LINE OF syntax.
    4.
    data: itab like vbak occurs 0 with header line.
        data: wa like line of itab
           (or)
         data: wa type vbak.
    Hope it clear?
    Thanks,
    Naveen.I

  • How can I use an IF ELSE statement and the xdoxslt: get_variable together?

    First of all, I'm a big fan of this forum and I just want to thank the community for helping make the BI Publisher world a better place.
    I'm trying to populate a table with a years worth of data with the column=PRODUCT and row=month of DATE. Here's the catch, not all of the months will have data. So here's where my problem is, I'm not able to use an IF ELSE statement along with a XDOXSLT:GET_VARIABLE expression so that if there's no data for that month the default value will be 0.
    Can someone help me find a solution to either one of the attempts below or a completely new method? Thanks!
    BP4 = numeric month value using DATE (more code to pull only month from DATE not included here)
    JAN1 = PRICE if data exists, else 0
    1) I tried this and it didn't work:
    <?if: xdoxslt:get_variable($_XDOCTX,'BP4'),01 then xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE) else xdoxslt:set_variable($_XDOCTX, 'JAN1',0) end if?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    2) I tried this and it didn't work:
    <?xdoxslt:ifelse(xdoxslt:get_variable($_XDOCTX,'BP4')='01',xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE),xdoxslt:set_variable($_XDOCTX, 'JAN1',0))?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    3) I tried this and it didn't work:
    <?xdofx:if xdoxslt:get_variable($_XDOCTX,'BP4')='01' then xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE) else xdoxslt:set_variable($_XDOCTX, 'JAN1',0) end if?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    sample XML:
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-01-01T00:00:00.000+08:00</DATE>
    <PRICE>31</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    -DrT
    Edited by: 990965 on Feb 28, 2013 8:27 AM

    let me clarify my logic, the template 1) searches for the relevant PRODUCT (in the case below, it searches for BPD which is the column in the table) 2) searches for the relevant month in DATE (which is the row in the table) 3) if data exists, get PRICE else default to 0
    Variable definitions:
    BP4 = numeric month value from DATE (more code to get this value not included here, but it works...)
    JAN1 = set to PRICE if data exists for that month, else 0
    the query is only pulling all of the existing data, so if there's no data for March then there wouldn't be a March entry in the xml. In the sample xml below, we only have data for the first two months (Jan, Feb) so that's the only data in the xml. I can't check if PRICE is null because the xml will not have any data for March.
    I've read through other threads and it seems that BI Publisher can't use an IF THEN ELSE with the XDOXSLT:GET_VARIABLE. I sent the template and xml to you.
    Sample XML:
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-01-01T00:00:00.000+08:00</DATE>
    <PRICE>31</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-02-01T00:00:00.000+08:00</DATE>
    <PRICE>30</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    Edited by: 990965 on Feb 28, 2013 8:30 AM

  • I want to upgrade to CS6 Production Premium suite from CS5.5.  Can I use CS6 upgrade made for CS5, or do I have to use upgrade that specifically states for CS5.5.

    I want to upgrade to CS6 Production Premium suite from CS5.5.  Can I use CS6 upgrade made for CS5, or do I have to use upgrade that specifically states for CS5.5.
    I am referring to the DVD installation Disks not Cloud.  Disk last release, I believe in 2012.
    Thank you.

    at the link i posted i see an upgrade for cs5 and cs5.5.
    you can contact adobe support if you don't see that.
    contact adobe support by clicking here and, when available, click 'still need help', https://helpx.adobe.com/contact.html

  • How to use Sequence in Forms

    Hi,
    I have an Empno Column, At the time of Opening a Form The Empno Will be displayed by using Sequence.
    If the User doesn't save the Form Then the Empno Generated number will be changed.
    How to write the code to get sequence numbers at Empno columns by using Sequence?
    Thanks & Regards,
    Hari Babu

    Ok, I understand now your question. Since the oracle sequence is commited in a separate transaction, it is not possible to get the no-gap sequence, considering your example. In the other hand, if you don't commit immediately, than two concurrently opened forms could use the same sequence number, so you'll get the duplicate key!
    If you're sure that this couldn't happen, you can manage your own sequencing, storing them in another table. Let's say you reached seq 999: entering the form, you'll read from your sequence table 1000, increment to 1001, and assign it to empno, but without commiting. Next time, you'll get the same number, until you commit form, and at the same time, change in seq table. So another will get 1001.
    Downside of this approach are, as mentioned before, concurrent sessions, which will get the same sequence.

  • Comenting code - style - how to keep coments where you want them - without using sequences

    Silly question maybe about style of commenting.
    Basically i like to use sequence boxes to keep comments on my diagram beside the bits of code that they refere to - otherwise when you use diagram cleanup (which i'm afraid i use all the time) they go anywhere.  This is good - except that i found especially when doing FPGA programming the sequence boxes reduce the amount of parralelism that can go on - since the 'box' needs to finish before any of the outputs can be used.  Is there some other method i should be using instead of sequence boxes to keep text beside elements - without enforcing that a set of elements are fixed in one place?
    Solved!
    Go to Solution.

    I usually use labels of structures (loops, cases, etc) and labels of diagram constants, etc. for comments. In newer versions, we also have wire labels.
    (see also)
    What is your LabVIEW version? Also the LabVIEW 2011 cleanup does a better job keeping diagram comments together with the related code compared to earlier version.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • How can i use Kontrol Rig 3 to control pedals in Mainstage

    Hi, I have Guitar rig 4 and the Kontrol Rig 3 controller and they work great together.  however, i would like to use the Kontrol RIg as a midi controller for the amps and pedals in mainstage.  could someone please help me out here with how to make th

  • To The Above Post: Will this CPU work with this MOBO.....

     Just a FYI the Link for the CPU compatibility checker 404s when I click on it.

  • Load balancing MQ 7.0 Foreign JMS Server and Weblogic 10 MDBs?

    We have the following configuration and we are trying to troubleshoot what appears to be a load balancing issue. We have 3 Solaris servers. Each Solaris server has two Weblogic managed servers running on it. There are a total of 6 managed servers in

  • Install of bundled product

    Hi everyone-- I have previously been using Photoshop Elements 6 (Windows version) but recently purchased the bundled product that contains Photoshop Elements 11 AND Premier Elements 11.  I just tried to install and realized that each one is installed

  • Buying  Oracle Collaboration Suite

    hi would you please tell me how and where i can buy "Oracle Collaboration Suite" with online payment ? and how to get Metalink account ? thx in adv