Dynamically calling sequence of table column

Hi all
CREATE TABLE  DYNAMIC_SEQ
  (
    SEQ_NAME VARCHAR2(20 BYTE)
  )


insert into DYNAMIC_SEQ values ('SEQUENCE1');
insert into DYNAMIC_SEQ values ('SEQUENCE2');
insert into DYNAMIC_SEQ values ('SEQUENCE3');
CREATE SEQUENCE  "SEQUENCE1" MINVALUE 1 MAXVALUE 999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER CYCLE ;
CREATE SEQUENCE  "SEQUENCE2" MINVALUE 1 MAXVALUE 999999 INCREMENT BY 1 START WITH 10 CACHE 20 NOORDER CYCLE ;
CREATE SEQUENCE  "SEQUENCE3" MINVALUE 1 MAXVALUE 999999 INCREMENT BY 1 START WITH 15 CACHE 20 NOORDER CYCLE ;
Is it possible to get the nextval of these sequences dynamically. For example, with a loop using dbms_output to show the result? In certain conditions of use the sequnce1.nextval in the other - sequence2.nextval? Is - it possible to store sequences in a table?



Version:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
"CORE     10.2.0.4.0     Production"
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
Thanks in advance,
Bahchevanov.

Edited by: bahchevanov on February 8, 2012 12:15 AM

Maybe NOT TESTED!

declare

  v_res varchar2(2000);
  v_val number := 0;

begin

  for i in (select * from dynamic_seq where seq_name like 'SEQUENCE%')
  loop

    v_res := 'begin select ' || i.seq_name || '.nextval into :v_val from dual; end;';
/*
    v_res := 'begin :v_val := ' || i.seq_name || '.nextval; end;';
*/
    execute immediate v_res using out v_val;

    dbms_output.put_line(v_val);

  end loop;

end;

Concerning

Etbin

Tags: Database

Similar Questions

  • Color of the dynamic lines in < af:table >

    Hello
    I need these examples to set the line color of the < af:table > that will rely on its value by programmetic way.
    Can you please help me with this result.

    Thank you.
    Zed
    ===

    Hi Zaza,

    You can try something like that. Some things to note:

    (1) the getColStyle() method will be called for each table column visible on each line displayed on the screen. That's why you need the int index = total / #, where # is the total number of columns on a line that is associated with this attribute.
    (2) the getYourVisibleTableRows (...) method must return only the visible set of lines that are displayed on the screen, not the entire recordset.

    /** Jspx page **/
    
            ....
        
        
            ....
        
        
            ....
        
    
    
    /** backing bean **/
    private String colStyle;
    private int total = 0;
    
    public void setColStyle(String colStyle) {
        this.inlineStyle = inlineStyle;
    }
    
    public String getColStyle() {
        colStyle = "";   // default background-color
        List rows = getYourVisibleTableRows(.......);
        int index = total / 3;  // Assuming 3 visible columns have their inlineStyle binded to this method.
    
        Row row = rows.get(index);
        if (row != null) {
            ...
            if (... // your condition) {
                colStyle = "background-color: #C0C0C0";
            }
        }
        total++;
    
        return colStyle;
    }
    

    Kind regards
    Amélie Chan

  • It is possible to implement a dynamic table column header?

    Hello

    I want to have a dynamic array to which guest column can be changed by the business logic.

    Eric,

    I did the same thing and its working well. As I have tested in advanced table, make sure the ID you provide.

    OAAdvancedTableBean table = (OAAdvancedTableBean)webBean.findChildRecursive("TableRN");
    
    OAColumnBean columnBean =   (OAColumnBean)table.findIndexedChildRecursive("FirstNameCol");//FirstNameCol is the id of the column
    OASortableHeaderBean colHeaderBean =   (OASortableHeaderBean)columnBean.getColumnHeader();
    colHeaderBean.setText("Test Column Header");
    

    Kind regards
    GYAN

  • Select the table column group and generate a sequence number

    I have to select data from a table column group and generate a sequence for every reset of the sequence from 1 to leave.

    For example:

    Data:
    Col1 Col2 Col3 Col4
    A NA KA-2009-08-13
    B NA KA-2009-08-13
    C NA KA-2009-08-13
    A NA KA-2009-08-13
    B NA KA-2009-08-13
    A NA KA-2009-08-13

    Expected results of the Select statement:
    Col1 Col2 Col3 Col4 Seq_No
    A NA KA-2009-08-13 1
    A NA KA-2009-08-13 2
    A NA KA-2009-08-13 3
    B NA KA-2009-08-13 1
    B NA KA-2009-08-13 2
    C NA KA-2009-08-13 1

    How can it be possible with a SELECT statement? Is it possible to assign the following numbers for a group of columns and put it back when it changes? In the above example, all columns are the key to generate the seq number

    I know that this can be done using procedures stored and that is how I do it now by introducing a temporary table.

    Can someone help me with this? Please let me know if the question is too vague to understand!

    Thank you
    Nachi

    Use the row_number() analytics.

    Ravi Kumar

  • Dynamically call a demon or an actor VI in TestStand

    Hi all

    The context:

    • I have a non-reentrant VI that must run in parallel to a sequence
    • This VI is opened and closed several times during the tests.
    • I close the VI sending him a pending request as it closes.

    It seems to me that there are two ways to start the VI:

    • Have TestStand call a LabVIEW VI that launches the dynamic VI. This could be the static node in the CGRA or an invoke node using a ref VI.
    • Use the asynchronous step "Run VI" in TestStand type.

    Right now I use the step "Run VI" asynchronous. I do not use the option "Reserve loaded live for execution", and once from time to time I get the crash 'TestStand sequence editor has stopped working ".

    My questions:

    1. With regard to memory management, which is the best way to put in place my use case? Is it better to have LabVIEW make the dynamic call or TestStand call dynamic?
    2. What is the difference in between both of these memory management works?

    Thanks a lot - suggestions are appreciated.

    Mr. Jim

    Let us know how it goes with the movement of the sous-suite.

    Basically the call run VI Asynch just dynamically create a sous-suite and qualifying in a new thread.  You can view it in the definition of step Type in one of the PreSteps.  But using the subsequence you eliminate the part of the dynamic generation of it (I've seen topics with, similar to what you describe).

    Good luck

  • can we use service legend to dynamically call business service in OSB

    My requirement is: contact service issue. moments of for - each loop in OSB. Node road that we cannot use in the foreach loop.

    can we use service legend to call business several times? and how can we pass endpoint url to business service using the legend of service.

    Please help me.

    Yes you can use routing options to override the legend service endpoint url. See

    http://docs.Oracle.com/CD/E23943_01/admin.1111/e15867/proxy_actions.htm#i1315299

    The action of routing Options can be used when the context variable $outbound is valid. It can be added to the following actions:

    • Publish
    • Dynamic publishing
    • Publish the Table
    • Legend of service
    • Routing
    • Dynamic routing
    • Routing table
  • Insertion of a DML statement as string in a table column


    Hello

    Is there a way I can insert a dml statement (such as "update a SET COL1 = 10") in a table column using a procedure or a function.

    I can do it by simply running an INSERT statement. But how can I do with a proc or function without getting an error "Cannot perform a DML operation inside a query"

    Please advice

    Hello

    937454 wrote:

    In fact, it can be done through a procedure. I was trying to see if I can do this with a function.

    Of course, you can do so via a function; you just can not call this function of a SQL statement.

    If the function returns a VARCHAR2, then you could call it like this:

    DECLARE

    foo VARCHAR2 (100);

    BEGIN

    foo: = fun_a;

    END;

    or like this:

    BEGIN

    dbms_output.put_line (fun_a);

    END;

  • Title of the report based on the value of the Table column

    Hello

    We use OBIEE 10 g.

    We have a Table and a chart based on the table in a report.

    Assume that the table has two columns, ID and NAME

    can we refer dynamically the value of the column NAME in the title of the report?
    for example
    the table has

    ID | NAME
    -------------
    123 | GS

    now, we would like the title to appear as

    Report for the GS

    where GS is dynamic

    Use the narrative mode and refer to the column that you want to display using @2 and place it instead of view title.

    Thank you
    Isabelle Renon

    Published by: Rajesh Raoul - BI on May 2, 2013 05:59

  • Dynamically call DBMS_XMLINDEX to delete the setting and exit with the exception

    Hi all

    I am trying to create a procedure to dynamically call DBMS_XMLINDEX.dropparameter.
    If the parameter doesn't exist no then gracefully exit with the exception as "the parameter does not exist.
    But I keep getting errors because of the dynamic passing.
    Procedure is something like:


    Create PROCEDURE drop_parameter (p_parameter IN VARCHAR2)
    IS
    no_parameter EXCEPTION;
    PRAGMA EXCEPTION_INIT(no_parameter,-12004);
    BEGIN
    RUN IMMEDIATELY ' DBMS_XMLINDEX.dropparameter ("| p_parameter |") ';
    dbms_output.put_line ('abandoned parameter');
    EXCEPTION
    WHEN no_parameter THEN
    dbms_output.put_line ('parameter does not exist');
    END drop_parameter;

    For the implementation we can try to create the parameter in the form:

    BEGIN
    DBMS_XMLINDEX. () REGISTERPARAMETER
    'Param1 ',.
    ' PATH TABLE PathTB1
    Paths (INCLUDE (/ a/b / c))
    / d/e/f
    ))
    ');
    END;
    /

    The setting above should be deleted or if not existing, then exit gracefully.
    Please suggest.

    Thank you...

    You test the incorrect error code...

    ORA-12004: http://docs.oracle.com/cd/E11882_01/server.112/e17766/e9858.htm#sthref3299

    Try with ORA-44737, for example:

    SQL> set serveroutput on
    SQL>
    SQL> BEGIN
      2  DBMS_XMLINDEX.REGISTERPARAMETER (
      3  'Param1', 'PATH TABLE PathTB1 PATHS (INCLUDE ( /a/b/c /d/e/f ))');
      4  END;
      5  /
    
    PL/SQL procedure successfully completed
    
    SQL>
    SQL> CREATE PROCEDURE drop_parameter(p_parameter IN VARCHAR2)
      2  IS
      3    no_parameter EXCEPTION;
      4    PRAGMA EXCEPTION_INIT(no_parameter,-44737);
      5  BEGIN
      6    DBMS_XMLINDEX.dropparameter(p_parameter);
      7    dbms_output.put_line('Parameter dropped');
      8  EXCEPTION
      9    WHEN no_parameter THEN
     10        dbms_output.put_line('Parameter does not exist');
     11  END;
     12  /
    
    Procedure created
    
    SQL> exec drop_parameter('Param1');
    
    Parameter dropped
    
    PL/SQL procedure successfully completed
    
    SQL> exec drop_parameter('Param1');
    
    Parameter does not exist
    
    PL/SQL procedure successfully completed
     
    

    (and even once, you do not need code dynamics)

  • SQLLDR table-&gt; column mapping excel column

    CREATE TABLE "DW". "" ABC ".
    ("SKILL_NAME" VARCHAR2 (60 BYTE) ACTIVATE NOT NULL,)
    VARCHAR2 (20 BYTE) "SKILL_TYPE."
    "DAILY_DATE" DATE NOT NULL ACTIVATE.
    VARCHAR2 (60 BYTE) "SCC_NAME."
    NUMBER (8.0) "RFS_FORECAST."
    NUMBER (8.0) "FORECASTED_CALLS."
    NUMBER (8.0) "TOTAL_CALLS_ANSWERED".
    ) ;

    It is a table.


    Following are excel columns

    Date of RFS CALLS PLANNED projected TOTAL CALLS


    Control file is the following

    load data
    CHARACTERSET UTF16
    INFILE 'D:\CSVs\4cols.csv '.
    in table
    'ABC '.
    fields ended by ',' optionally surrounded "" "
    (
    CONSTANT "FM," SKILL_NAME
    SKILL_TYPE CONSTANT 'CUSTOMER ',.
    DAILY_DATE,
    SCC_NAME CONSTANT NULL,
    RFS_FORECAST,
    FORECASTED_CALLS,
    TOTAL_CALLS_ANSWERED)

    How to associate the table columns with excellent columns...

    and if the first row of the excel is the header of the specification that

    See if that answers your question:
    [http://www.dba-oracle.com/t_sql_loader_date_format_error_syntax.htm]

  • Set the value of the parameter in the call sequence by programming

    Is there a way to set the value of the parameters of a call sequence with a vi with the context of the sequence in the order which is called? Cases not the same subseqence with a vi in the mainsequence maybe?

    In your VI, I think you should be able to set the value of Step.TS.SData.ActualArgs.paranumber.Expr to the value of the setting that you want. (This property is visible in the Variables pane, only if you have configured the Options of Station to display hidden properties). Note that the purpose of the step should refer to the sequence of your call step.  Also, remember that the property represents an expression, so if you want to pass the value 33, you must enclose the value in quotes ("33").

    Jeff

  • Variable not expandable Container by calling sequence

    Hi all

    I created a custom variable (of type def in Labview) who is a type of container.  The front panel controls and indicators of my module code for the custom variable.  If I use the variable type custom in my sequence of high level, it seems to work ok.  However, if I use in my void sequences and pass it as a parameter to the next level call sequence, the parameter is not extensible, which means that I can't select individual items for logging, or a reassignment.  Any ideas?  Thanks in advance.

    GSinMN

    It is not possible in the current version of TestStand.  I really really really really wish that it was...

    http://forums.NI.com/T5/NI-TestStand-idea-exchange/allow-sequence-adapter-to-expand-containers-in-th...

    Kind regards

  • Create table 2d by pulling larger 2d table columns, as indivated by an array of Boolean

    Hello

    I have a 2d chart with 16 columns that contain data from different input channels.  I also have a 1 d array of Boolean (length 16) corresponding to these columns.  In the table of Boolean 1 d, if a value is true, I want this column in table 2d to stay.  If the value in the table of Boolean 1 d is wrong, I want to delete the corresponding column.

    Thus, for example, if the table of Boolean 1 d looks like this:

    [T T T T F F T T T F T T F F T F]

    the new 2d array would be 10 columns, which correspond to the columns of the old 16-column of table 1, 2, 3, 4, 7, 8, 9, 11, 12 and 15.

    I am very new to labview (programming just started yesterday). Can someone help a newbie to do something that is probably simple? In my view, that there will be an iteration back through the deletion of rows and 16 columns table columns as they come if the value of the Boolean vector is false, or iterate forward through the 16 columns and add columns to a table if the value of the Boolean vector is true... but I don't know how to do this.

    Thank you

    Matt

    If you have 2012 you could just do this:

    -Ryan S.

  • With the help of dynamically called screw in TestStand deployment

    I write code to interface with a & Rohde Schwarz ZNB Network Analyzer.  I use LabVIEW 8.2 and TestStand 3.5.  For reference the ZNB driver is available here: R & S of ZNB Driver.  I use a slightly older version of the driver, some before they needed to LabVIEW 2009.  I am writing all the code on a development machine that has the full version of TestStand/LabVIEW and it works on another machine that has the TestStand deployment license.

    This driver is dynamically linked to some things he needs.  I am able to operate with simple LabVIEW EXEs but not in TestStand deployments.  The following excerpt comes from their documentation, explaining a little about how the driver works and how to use in LabVIEW EXEs.

    3.4.2 How to generate executables or libraries in LabVIEW driver kernel drivers instrument based on attributes is dynamically bound to any VI performed during execution. This can be recognized by the LabVIEW application builder. The LabVIEW application builder follows all the static dependencies and include them in the package distributed at the generation of an executable file.

    To create an executable in LabVIEW, please manually add all the screws in the \PREFIX \_utility\callbacks folder to the LabVIEW project. In the case of project based please add private to your project folder. With this reference manual, the driver core is included in the compilation and the driver core is accessible during execution.

    I can't get this to work in TestStand deployments at all.  I can't even connect to the device since the VI Init has these issues.  I get the same error for all the various attempts that I made.  The same error is that when you add manually the screws for the LabVIEW EXE.

    Error-1073807346

    Property in Rohde & Schwarz Vector Analyzer.lvlib:rsidr_core_session_fgv.vi-> network node

    Rohde & Schwarz Vector Network Analyzer.lvlib:rsidr_core_check_error.vi->

    Rohde & Schwarz Vector Network Analyzer.lvlib:rsidr_core_attribute_write_int.vi->

    Rohde & Schwarz Vector Network Analyzer.lvlib:rsidr_core_attribute.vi:3->

    Rohde & Schwarz Vector Network Analyzer.lvlib:rsvna.vi:2->

    Example 1 setting of the Instrument 24Default .vi:1->

    Rohde & Schwarz Vector Network Analyzer.lvlib-> efault Instrument Setup.vi

    Rohde & Schwarz Vector Network Analyzer.lvlib:Reset.vi->

    Rohde & Schwarz Vector Network Analyzer.lvlib:Initialize.vi->

    Connection of ZNB testing.VI

    VISA: (Hex 0xBFFF000E) the given reference of session or the object is not valid.

    So far, I tried the following, all solutions producing this same error.  I struggled with this and turned off for awhile then maybe there are other solutions attempts I forget.

    (1) it looked like a lot of the report to go to the private folder were finished in SupportVIs.  I manually pasted the rest there, too.

    (2) I added all driver files on my workspace and included in the files with the rest of my deployed screws.

    (3) I added all driver files on my workspace and said pilot TestStand to deploy them to the original location in Program Files.

    Someone at - it ideas?  R & S didn't even know what was TestStand, so that they could not help me.

    I was finally able to solve this problem on mine, the other day.  I brought the Network Analyzer to my office and did a lot of tests in this way.  Eventually, I discovered that I needed to include the folder private pilot deployment, what I was doing in one of previous attempts.  It turns out that you must also maintain the original of this file directory structure when you include it, otherwise dynamic calls are not looking in the right place.  Once it worked on my PC, I got it on the machine test and worked as well.

  • How to remove an instance of "entering a call sequence" according to the report from teststand

    I use TestStand 4.2 and I use a long sequence with several subsequences.  In these subsequences, I get the results of the tests that I want to put in the report of TestStand.  Currently, for this I need to check her option "result Record' in the Options"run"the call of the sequence of properties that displays a 'seizure call sequence' mark on the report.  Is it possible that I can get rid of this marker and always save the void sequence information?


Maybe you are looking for