How to Use Sequence in Oracle Views

Hi ,
I have created a view which gives the information about the access rights which a Resource has got. for ex -
Res1 - GYM access - member
Res1 - Swimingpool Access - member
I need to identify a Primary Key for this data set. So i thought that i'll use a Sequence to generate an extra column in this view.
But when i'm using the Sequence i'm getting the following error - "ORA-02287".

you can use sequence within view it doesnot returned error;
create sequence t1_seq MAXVALUE 150
START WITH 39 INCREMENT BY 1;
SQL> insert into t1_view values(t1_seq.nextval,'dd');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
ID NA
10 aa
20 bb
30 cc
40 dd
4 rows selected.
SQL> insert into t1_view values(t1_seq.nextval,'ee');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
ID NA
10 aa
20 bb
30 cc
40 dd
41 ee
5 rows selected.

Similar Messages

  • How to use css in oracle forms

    Hello,       I am using oracle forms 11g with weblogic server 10.3.5 at windows 7.I have to use CSS in oracle forms.i have tried to search it but no profit.please some one else tell me that how can use css in oracle forms. Thnak You regards aaditya

    Hi
    As Francois pointed out Oracle forms has nothing to do with html based technology. The way you can get the equivalent effect of creating consistancy in the way your objects are displayed is by creating a set of items you want and alter their apperance and behaviour and place them into object libraries (one library should do the trick).  From there you subclass all of you forms items off these libraries.
    Regards
    Quintin

  • How to use iframes in oracle 10g

    I have to load two jsp pages in a single html . I have done that thru iframes. But i have to dynamically load the second jsp page in the frame 2 , when the user clicks upon certain details in the frame 1 jsp page. I have wriiten the code of document.iframe in format trigger attribute. It doesn't work. Is there any other way to achieve this. I want to load the frame 2 jsp page dynamically , according to the input i get from frame 1 jsp page.

    Hi,
    >>Anybody know how to use profiler in oracle 10g
    What do you mean "profiler". About Resource Limits/Create Profiles ?
    >>i couldn't able to install the enterprise manager console.
    What OS ?
    >>because i need to trace the execution of a stored procedure.waiting the reply.
    Debug ? You can use SQL Developer, TOAD, PLSQL Developer for this purpose.
    Cheers

  • How to Use Profiler in ORACLE 10g

    Hi all,
    Anybody know how to use profiler in oracle 10g and also i couldn't able to install the enterprise manager console.is there any tools available for that.because i need to trace the execution of a stored procedure.waiting the reply.
    Sathish

    Hi,
    >>Anybody know how to use profiler in oracle 10g
    What do you mean "profiler". About Resource Limits/Create Profiles ?
    >>i couldn't able to install the enterprise manager console.
    What OS ?
    >>because i need to trace the execution of a stored procedure.waiting the reply.
    Debug ? You can use SQL Developer, TOAD, PLSQL Developer for this purpose.
    Cheers

  • How to Use Sequence created in Oracle Database in SQL Ldr Control file

    Hi,
    I created a sequence in oracle database. How will use the sequence in SQL loader Control file.
    Thanks in advance

    Hi,
    You might get a good response to your post in the forum dedicated to data movement , including SQL*Loader . You can find it here Export/Import/SQL Loader & External Tables
    Regards,

  • MAX(SummaryNum) +1 bad idea, but how to use sequence part composite column

    Hi,
    My relational mode is as follows
    Policy (policynum PK) has 1:M with Summary (policynum FK, SummaryNum part of PK, other columns part of PK)
    Basically for each policy users can enter notes with SummaryNum 1, 2, 3, 4.... These numbers are shown to the user for tracking purpose. I need to make sure summary notes for EACH policy start with 1 (cannot really use sequence in the table in the strictest sense) and are incremented by 1. The current Oracle form basically creates the next highest possible value of SummaryNum by adding one to the currently available highest value. In brief, it is like a sequence number for summaries of a particular policy in the summary table.
    PRE-INSERT
    SELECT MAX(SummaryNum ) + 1
    FROM Summary
    I am trying to replicate this in ADF BC (using 11g) and know that not using sequencing and adding one to get the next number is a very bad idea due to concurrency challenges (transactional ACID properties). The reasons are as follows.
    •     Using MAX(policy_memo_seq_num) + 1 is not scalable,
    •     It will lead to duplicates in a multi-user environment, whether ADF BC, Oracle Forms, or any other technology
    I also know how to use create a sequence in db, a related trigger, and then set the attribute in EO properties as DBSequence. My challenge is that since SummaryNum is not a primary key, and instead is part of a composite key in my case, how do I make sure that summary notes for EACH policy start with 1 in the Summary Table.
    I appears that i cannot really use sequence in the table in the strictest sense as this will mean that for policies the summaryNum will start from the next available sequence number, but what i really want is to have it start by one for all policies.*
    I would appreciate any help.
    Thanks,

    Not sure if there is a better way, but here is one way. Let's say your table was like this:
        SQL> desc versioned_item
         Name         Null?    Type
         ID           NOT NULL NUMBER
         VERSION      NOT NULL NUMBER
         DESCRIPTION           VARCHAR2(20)and lets say your data looked like this:
        SQL> select * from versioned_item order by id, version
                ID    VERSION DESCRIPTION
              1001          1 Item 1001
              1001          2 Item 1001
              1001          3 Item 1001
              1002          1 Item 1002
              1002          2 Item 1002
              1003          1 Item 1003To select only the rows for the max-version-id, you could do this:
        select id, version,description
        from versioned_item
        where (id,version) in (select id,max(version) from versioned_item group by id)
        order by id
                ID    VERSION DESCRIPTION
              1001          3 Item 1001
              1002          2 Item 1002
              1003          1 Item 1003To capture this as a view object, you'd only just need to paste in the WHERE clause above into the Where clause box of the view object. No need to use expert-mode since you're not changing the select list or from clause.

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

  • 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

  • How to use parameters in oracle SQL script????

    Right now I am writing a SQL script to create a schema and build the objects of this schema....
    I use a .net winform program to run sqlplus to parse this sql script ...
    The problem is that the schema name and the tablespace's location and the sys password must be input by the user, so my SQL script should use these runtime input parameters instead of const parameters....
    So, how to use parameter in SQL script ...........
    Are there some example scripts in oracle home directory for me to refer to????

    Hi,
    UNISTD wrote:
    thanks .....
    what's the difference between variable , define, accept in sqlplus ???VARIABLE declares (but does not assign a value to) a bind variable. Unlike substitution variables, bind variables are passed to the back end to be compiled, and they can only be values in certain data types. You can not use a bind vaiable in place of an identifier, so to do something like
    CREATE USER  &1 ...a bind variable won't work.
    "DEFINE x = y" sets the substitution variable &x to have the value y. There is no user interaction (unless x or y happen to contain undefined substtiution variables).
    "DEFINE x" shiows the value of the substitution variable &x, or, if it is undefined, raises a SQL*Plus error. I use this feature below.
    ACCEPT sets a substitution variable with user interaction.
    And if the user miss some parameters in “sqlplus /nolog ssss.sql par1 par2 par5 par6”, how to use default value of the miss parameters??Don't you need a @ befiore the script name, e.g.
    sqlplus /nolog @ssss.sql par1 par2 par5 par6Sorry, I don't know of any good way to use default values.
    The foloowing works, but, as you can see, it's ugly.
    "DEFINE 1" display a message like
    DEFINE 1            = "par1" (CHAR)if &1 is defined; otherwise,it will display a SQL*Plus error message like
    SP2-035: symbol 1 is UNDEFINEDNotice that the former contains an '=' sign, but the latter does not.
    The best way I know to use default values is to run the DEFINE command, save the output to a filee, read the file, and see if it's an error message or not.
    So you can use a script like this:
    --     This is  DEFINE_DEFAULT.SQL
    SPOOL     got_define_txt.sql
    DEFINE     &dd_old
    SPOOL     OFF
    COLUMN     dd_new_col     NEW_VALUE     &dd_new
    WITH     got_define_txt     AS
         SELECT  q'[
              @got_define_txt
    ]'               AS define_txt
         FROM    dual
    SELECT     CASE
             WHEN  define_txt LIKE '%=%'
             THEN  REGEXP_REPLACE ( define_txt
                               , '.+"
    ([^"]*)
                         , '\1'
             ELSE  '&dd_default'
         END        AS dd_new_col
    FROM     got_define_txt
    {code}
    and start your real script, ssss.sql, something like this:
    {code}
    DEFINE          dd_new     = sv1
    DEFINE          dd_old     = 1
    DEFINE          dd_default     = FOO
    @DEFINE_DEFAULT
    DEFINE          dd_new     = sv2
    DEFINE          dd_old     = 2
    DEFINE          dd_default     = "Testing spaces in value"
    @DEFINE_DEFAULT
    {code}
    when this finishes running, the substitution variable &sv1 will either have the value you passed in &1 or, if you didn't pass anything, the default value you specified, that is FOO.
    Likewise, &sw2 will have the value you passed, or, if you didn't pass anything, the 23-character string 'Testing spaces in value'.
    Here's how it works:
    Define_default.sql puts the output of the "DEFINE x" command into a column, define_txt, in a query.  That query displays either the existing value of the substitution variable indicated by &dd_old or, if it is undefined, the default value you want to use, which is stored in the substitution variable &dd_default.  The substitution variable named in &dd_new is always set to something, but that something may be its existing value.
    Notice that the paramerters to define_default.sql must be passed as global varibales.
    Why didn't I just use arguments, so that we could simply say:
    {code}
    @DEFINE_DEFAULT  sv1  1  FOO
    {code}
    ?  Because that would set the substitution variables &1, &2 and &3, which are miost likely the very ones in which you're interested.
    I repeat: there must be a better way, but I'm sorry, I don't know what it is.
    I usually don't do the method above.  Instead, I always pass the required number of parameters, but I pass dummy or plce-holder values.
    For example, if I wanted to call ssss.sql, but use defulat vlaues for &1 and &3, then I would say something like:
    {code}
    @ssss  ?  par2  ?
    {code}
    and, inside ssss.sql, test to see if the values are the place holder '?', and, if so, replace them with some real default value.  The use has  to remember what the special place holder-value is, but does not need to know anything more, and only ssss.sql itself needs to change if the default values change.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to use help in oracle 10g XE

    Hello,
    I just wanted to know how to use help in sql command line in oracle 10g XE
    regards,
    Sreekanth.

    Hi thankyou very much for the answer, that web-page is very good but....
    I was hoping for answer that would walk me through the help command used in the SQL PLUS like: "help create"
    after i have read few manuals i came to know we can use @hlpbld.sql for building help tables it asks me for entering value 1 and 2, after that it exits the prompt and when i re-login i dont see "help command" working...
    any comments ot procedure to do this...

  • How to use a non-Oracle database?

    Oracle Lite is used as the database per default. Technical
    notes describe how to use Oracle 9i. I'm more interested in using more light-weight RDBMSes like HSQLDB for example. It is been said that Oracle BPEL supports Oracle, Oracle Lite, DB2, SQL Server and Pointbase. Now how to configure Oracle BPEL to use each of the non-Oracle datbases listed above?

    I've managed to setup the PM to use Pointbase rather than the default Oracle Lite. Along the way, several questions came up:
    1. Since the directory system\database\scripts already provides DDL scripts for Pointbase, creating the tables of a Pointbase database was easy. However, I wonder why you don't support HSQL. After all, OC4J supports HSQL data sources (see database-schemas\hypersonic.xml). Are there any features required by Oracle BPEL that are not provided by HSQL? If not, can we just use the Pointbase DDL scripts for HSQL?
    2. Editing the data-sources.xml file also wasn't a big deal although templates for Pointbase were missing. BTW, my XML editor reports the data-sources.xml file to be invalid: "Document cannot be stand-alone because default-value attribute 'connection-retry-interval' is not explicitly assigned.
    3. The changes in StartOraBPEL.bat were:
    - Comment out running kill_olite.bat and start_olite.bat
    - Start the Pointbase server (rather than Oracle Lite)
    4. The needed changes in obsetenv.bat were not that obvious: It was required to add the Pointbase libs to the BOOT_LIB classpath. Otherwise the Pointbase driver cannot be loaded. To be on the safe side, I've also added the Pointbase libs to the MY_CLASSPATH classpath but I'm not sure if that is really required. Is it?
    5. Finally, it would be good if shutting down the Pointbase server could be done in a similar fashion as that is configured for Oracle Lite. Apparently, some sort of hooking is used. Now how to setup a shutdown hook for a Pointbase server?

  • How to use layout of one view(some part) in another view

    Hi All,
                 I need how to use a layout of one view(some part) in another view.if anybody knows, help me.
    Ex : I took two views.but some part of layout in first view is also needed in second view.Is it possible.
    Thank You,
    Anupama.

    Hi,
    Whichever common ui elements you want to put in both views. Keep them in one view.
    Now create two views which You want to display.( i.e you have to create three views in that two only will be used for display purpose ) In that both views add viewcontainer ui element and embedd that view which has common UIs. And Then add rest uncommon UIs in both views.
    I hope it helps.
    Regards,
    Rohit

  • How to use ed in oracle 11g as we do in 10g

    Hi,
    Anyone can u tell me how to use text editor in oracle 11g as
    we do in 10g.
    thanks
    srinivas

    Well, that would be because notepad doesn't exist on *nix - isn't that obvious?                                                                                                                                                                                   

  • How to use EBU in oracle 7.3.4

    I want to use ebu to create the catalog database and target
    database.I have use rman in oracle8.1.7 successfully.But I don't
    know the procedure for ebu .If you know how to use the ebu
    please let me know .Thanks.
    Best regards.

    Touch and hold the App until the apps wiggle and show an X in the upper left corner of the App.
    Click the X to delete it from your device.
    Not all Apps can be deleted.
    If they came with the device, you cannot delete them.

  • How to use Parameter in inline view

    I want to deploye following sql in discoveror. Problem is that how to use the P_TO_DATE in disco.
    select papf.employee_number, papf.effective_start_date, papf.effective_end_date, paaf.effective_start_date, paaf.effective_end_date,
    (select peev.screen_entry_value
    from pay_element_types_f pet,
    pay_element_classifications pec,
    pay_input_values_f piv,
    pay_element_entries_f pee,
    pay_element_entry_values_f peev
    where pet.classification_id = pec.classification_id
    and pet.processing_type = 'R'
    and pec.classification_name = 'Earnings'
    and piv.name in ('Monthly Amount')
    and pet.ELEMENT_TYPE_ID = piv.ELEMENT_TYPE_ID
    and pet.element_type_id = pee.element_type_id
    and piv.INPUT_VALUE_ID = peev.INPUT_VALUE_ID
    and pet.ELEMENT_NAME = 'Basic Salary'
    and pee.ELEMENT_ENTRY_ID = peev.ELEMENT_ENTRY_ID
    and pee.assignment_id = paaf.assignment_id
    and pee.effective_start_date <= :P_TO_DATE and pee.effective_end_date >= :P_TO_DATE
    and peev.effective_start_date <= :P_TO_DATE and peev.effective_end_date >= :P_TO_DATE ) Basic_Salary
    from per_assignments_f paaf, per_people_f papf
    where papf.person_id = paaf.person_id
    and papf.employee_number = '101111'

    Hi,
    What you can do is to change the query so that the parameters will be in the where clause and then you can define the condition with the parameter in the dicoverer worksheet.
    Use the following code instead of your own:
    select papf.employee_number,
    papf.effective_start_date,
    papf.effective_end_date,
    paaf.effective_start_date,
    paaf.effective_end_date,
    Basic_Salary.p_start_date1, ---> create the conditions on those fields
    Basic_Salary.p_start_date2,
    Basic_Salary.p_end_date1,
    Basic_Salary.p_end_date2
    from per_assignments_f paaf,
    per_people_f papf,
    (select peev.screen_entry_value,
    pee.assignment_id,
    pee.effective_start_date p_start_date1, --parameter
    pee.effective_end_date p_end_date1, --parameter
    peev.effective_start_date p_start_date2,--parameter
    peev.effective_end_date p_end_date2
    from pay_element_types_f pet,
    pay_element_classifications pec,
    pay_input_values_f piv,
    pay_element_entries_f pee,
    pay_element_entry_values_f peev
    where pet.classification_id = pec.classification_id
    and pet.processing_type = 'R'
    and pec.classification_name = 'Earnings'
    and piv.name in ('Monthly Amount')
    and pet.ELEMENT_TYPE_ID = piv.ELEMENT_TYPE_ID
    and pet.element_type_id = pee.element_type_id
    and piv.INPUT_VALUE_ID = peev.INPUT_VALUE_ID
    and pet.ELEMENT_NAME = 'Basic Salary'
    and pee.ELEMENT_ENTRY_ID = peev.ELEMENT_ENTRY_ID
    ) Basic_Salary
    where papf.person_id = paaf.person_id
    and Basic_Salary.assignment_id = paaf.assignment_id
    --and Basic_Salary.p_start_date1 <= :P_TO_DATE
    --and Basic_Salary.p_start_date2 <= :P_TO_DATE
    --and Basic_Salary.p_end_date1 >= :P_TO_DATE
    --and Basic_Salary.p_end_date2 >= :P_TO_DATE
    --and papf.employee_number = '101111'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Difference Between SAP ECC. 6.0 and 4.6c

    Hi What is the Difference Between SAP ECC. 6.0 and 4.6c with respect to module wise, like SD, MM, FI, thanks Satish

  • What is the procedure to create entry in NAST table for particualr document

    Hello ABAP GURUS, I need to know how to create objectkeys in NAST table for particualar document number. My requirement is i need to check my smartform output for Goods Receipt.IN nast table,i dont have any entries for Goods Receipt.So i need to crea

  • Run time error 4605

    Hi friends when i try to insert fields I am facing an issue has run time error 4605 Application error or object-defined error.Actually I got my application from my client has a document format I just converted to rtf.when I load the data its taking p

  • Is it possible to share a sequence between computers and different projects?

    Is it possible to share a sequence between computers and different projects without copying the sequence, closing the project, opening the new project and pasting in the sequence. This workflow is to slow when it takes 40 minutes for Premierer Pro CC

  • Deploying in cluster env

    HI, we have a clustered env for our production system. i defined a track and set up the runtime systems. since our production box is a clustered environoment, i specified the SDM hostname as the host on which the central instance is running. so when