Problem with creating a sequence

Hello

I'm having a problem with a sequence that I am creating. Basically, I'm trying to create a sequence with a default value based on the value in another table, i.e.
CREATE SEQUENCE seq
START WITH (
            min(customer_id) from customer
            )
INCREMENT BY 1;
Is this possible? I get errors.

You can use dynamic sql or, if you use SQL * more take advantage of substitution variables:

SQL> DROP SEQUENCE seq
  2  /
DROP SEQUENCE seq
              *
ERROR at line 1:
ORA-02289: sequence does not exist

SQL> DECLARE
  2      stmt VARCHAR2(1000);
  3  BEGIN
  4       SELECT  'CREATE SEQUENCE seq START WITH ' || min(empno)
  5         INTO  stmt
  6         FROM  emp;
  7       EXECUTE IMMEDIATE stmt;
  8  END;
  9  /

PL/SQL procedure successfully completed.

SQL> SELECT seq.NEXTVAL FROM dual
  2  /

   NEXTVAL
----------
      7369

SQL> DROP SEQUENCE seq
  2  /

Sequence dropped.

SQL> COLUMN s NEW_VALUE s NOPRINT
SQL> SELECT  min(empno) s
  2    FROM  emp
  3  /

SQL> CREATE SEQUENCE seq START WITH &s;
old   1: CREATE SEQUENCE seq START WITH &s
new   1: CREATE SEQUENCE seq START WITH       7369

Sequence created.

SQL> SELECT seq.NEXTVAL FROM dual
  2  /

   NEXTVAL
----------
      7369

SQL> 

SY.

Tags: Database

Similar Questions

  • Problem with create table as select (DEC)

    Hello

    We try to data cleaning of huge tables. And a customer of guise is reanme main table to the backup table. Then create a master table in select * backup table with some test.

    Now the problem with create table select, is that it creates the table without indexes and constraints. Is it possible to use the ETG (create the select table) with the same structure that he was the (all index, constriaints).

    Or any other solution to solve this problem?

    Thanks in advance

    Sweety wrote:
    Hello

    We try to data cleaning of huge tables. And a customer of guise is reanme main table to the backup table. Then create a master table in select * backup table with some test.

    Now the problem with create table select, is that it creates the table without indexes and constraints. Is it possible to use the ETG (create the select table) with the same structure that he was the (all index, constriaints).

    Or any other solution to solve this problem?

    Thanks in advance

    No, this is not possible. You need to get the manuscript of dependent object and create it manually.

  • Problem with creating, truncating and deleting a database in 1 transaction

    Hello

    I came across a problem when it is in the same transaction creating a data base, truncating it and then delete it. Do these 3 things causes the following transaction validation to last forever.
    The following code causes the problem:

    File envHome = new File ("truncate-delete-test");
    envHome.mkdirs ();
    EnvironmentConfig envConfig = EnvironmentConfig.DEFAULT;
    envConfig.setAllowCreate (true);
    envConfig.setTransactional (true);
    envConfig.setTxnSerializableIsolation (true);
    Environment = environment (this.envHome, envConfig);

    Transaction txn = this.environment.beginTransaction (null, TransactionConfig.DEFAULT);

    DbConfig DatabaseConfig = new DatabaseConfig();
    dbConfig.setAllowCreate (true);
    dbConfig.setTransactional (true);
    String dbName = "test-db";
    Database db = this.environment.openDatabase (txn, dbName, dbConfig);

    CBI Close();
    environment.truncateDatabase (txn, dbName, false);
    DB = this.environment.openDatabase (txn, dbName, dbConfig);

    CBI Close();
    this.environment.removeDatabase (txn, dbName);

    TXN.Commit (); <-this statement would never return.

    I encountered this problem with version 4.0.92. I've updated to 4.1.7 but the problem still exists.
    Also, it manifests when the records are written to the database before and after it truncate.

    Looking in the process with the debugger shows the following stack trace during the commit endless happens:

    [...]
    DbTree.deleteMapLN (DatabaseId) line: 1069
    DatabaseImpl.finishDeleteProcessing (line): 1164
    Txn.cleanupDatabaseImpls (boolean) line: 1404
    TXN.Commit (durability) line: 728
    TXN.Commit (line): 549
    Transaction.Commit (line): 227
    [...]

    Depending on where I stop the process, there are additional calls on top of the stack.

    Exit Registration unfortunately does not help here, as the log messages stopped once the problem started to appear.

    Is it somehow not allowed to create, truncate and delete a database in the same transaction? I couldn't find anything in this sense in the documentation, and it is no exception either.
    Or have I came across a bug in I here?

    Thanks in advance for any advice or solutions.

    Christoph
  • Problem with creating a new line in widget glossary

    I use 6 Captivate and have a problem with trying to display text on a new line in the description field of the widget glossary. In playback mode, a carriage return displays form \n

    I read in another discussion (from early last year), that this problem had been resolved and that the fix would be communicated soon on the blog of captivate for users without a subscription. Anyone know if the fix has been shared yet - I can't find it anywhere?

    Thanks for any help you can provide.

    Tenneil

    Hi Tenneil,

    Greetings from Adobe.

    Please click on the link below and download the Interaction of Glosarry updated.

    https://files.Acrobat.com/a/preview/0a17bb28-049e-4AC7-b8f7-dbdacef5e91c

    1. Extract the zip to your desktop.
    2. Copy "08_Glossary.wdgt" into the extracted zip file.
    3. Go to: C:\Program Files (x 86) \Adobe\Adobe Captivate 6 (32 bit) \Gallery\Interactions (for 32-bit Captivate) or C:\Program Files\Adobe\Adobe Captivate 6 (64-bit) \Gallery\Interactions (for 64-bit Captivate).
    4. Replace the glossary widget in the record of the interaction. Restart the Captivate 6. (Make sure you take the backup of the original Glosarry Widget)
    5. Ask the widget again and check the issue.

    Let me know if it works for you.

    Kind regards

    MILIN

  • Problems with creating an image mask!

    I have problems with the creation of an image mask. I tried jpg and psd as alpha channel (black and white), but it seems that there is a bug. I also tried a mask "trace" (or whatever it is called in English - I use the German version) but it doesn't work either. Someone has any idea how to solve this problem? Thanks in advance

    You can use JPEG, just set it to Luma Matte. Make sure the mask is white pure for a clean mat.

    If its black set the market back.

  • ORA-29855 problem with creating an index

    Hi all,

    I am trying to create an index, but I have this problem:

    SQL > CREATE INDEX ITALIA_NODE_IDX ON ITALIA_NODE$ (GEOMETRY) INDEXTYPE IS MDSYS. SPATIAL_INDEX;
    CREATE INDEX ITALIA_NODE_IDX ON ITALIA_NODE$ (GEOMETRY) INDEXTYPE IS MDSYS. SPATIAL_INDEX
    *
    ERROR on line 1:
    ORA-29855: an error has occurred in the execution of routine ODCIINDEXCREATE
    ORA-13249: internal error in the Spatial index: [mdidxrbd]
    ORA-13249: error in the Spatial index: index build failed
    ORA-13249: error in the spatial index: [mdrcrtxfergm]
    ORA-13249: error in the spatial index: [mdpridxtxfergm]
    ORA-29400: data cartridge error
    ORA-01653: unable to extend table M2_10A70$ $.1024 by SPACE in tablespace USERS
    ORA-06512: a 'MDSYS. SDO_INDEX_METHOD_10I', line 10


    What do you think of this problem?
    Thank you in advance.
    Crystal

    Published by: crystal13 on June-18-2010 2.03

    Hello

    It looks like your USERS tablespace is small. You have no space left. Expand the size of the storage space by enlarging the file below or put a second to her, or put the tablespace mode AUTOEXTEND. See the guide administrators: http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tspaces.htm#i1010516

  • problem with creating a logical sequence

    create table t (a varchar2 (20), b number (8));
    insert into values t ('aa', 4);
    insert into values t ('ba', 6);
    Insert values into t ('ca', 7);
    insert into values t ('da', 8);


    instead of 8, it can be any number between 1 and 100

    If instead of number 8 is < 10
    Insert into t values('ea',10); -what I need dynamic insertion

    If instead of the number between 11-19 then
    Insert into t values('ea',20); -what I need dynamic insertion


    and so on


    I tried like below
    Select case when max (b) < 10 then 10 when max (b) between 10 and 20, then 20 end of t;

    but I can not write the case for again and again up to nth

    Insert into t ("ea" ceil ((select max (b) from t) / 10)) * 10);

  • Problems with creating an exe file

    Hello

    I'm trying to convert a vi to an executable. When I run the constructor it comes up with an error:

    Visit ni.com/ask support request page to learn more about the resolution of this problem. Use the following as a reference:

    Error 8 has occurred to create a folder to create a directory Recursive.vi-> AB_Destination.lvclass:Create_Destination.vi-> AB_Build.lvclass:Create_Destinations.vi-> AB_Application.lvclass:Create_Destinations.vi-> AB_Build.lvclass:Build.vi-> AB_Application.lvclass:Build.vi-> AB_EXE.lvclass:Build.vi-> AB_Engine_Build.vi-> AB_Build_Invoke.vi-> AB_Build_Invoke.vi.ProxyCaller

    Possible reasons:

    LabVIEW: File permission error. You do not have the correct permissions for the file.

    C:\Users\builds

    I can't understand the permissions that he speaks. I even changed my program a public folder.

    Thank you

    In the build settings, you said to save the generation to a public folder?

  • A good difficulty for problems with creating an account ePrint Center.

    Problem: impossible to register with ePrint Center

    Difficulty: The problem you are having is probably due to an old Snapfish account registered to your email address. ePrintCenter and Snapfish account information is stored in the same place and I saw this before conflict.

    You will need to go to http://www.snapfish.com/snapfish/welcome, click on "Sign In" in the upper right corner of the page and then click on the 'forgotten password' link and enter the email address that is causing your problems, you should receive an email from Snapfish, which allows you to create a new password. Once you have created a new password for Snapfish, try to Sign In on ePrintCenter (http://www.eprintcenter.com) using your email address and the password you created for Snapfish.

    If you have any other questions do not forget and let us know. We're here to help.

    If I have SOLVED your problem, please do not hesitate to provide LAURELS and make sure that you mark this thread as a SOLUTION OFFERED!

    Although I work for HP, my messages and responses are my own opinion and not of HP.

    In addition, if the fix above does not seem to solve the problem or if you are unsure if you have a Snapfish (http://www.snapfish.com) account, use the e-mail address you want to use with ePrint Center (http://www.eprintcenter.com) and then use the information that you created and try to "Sign In" or create an account on ePrint Center.

  • Problem with creating an image map

    I struggled to create a simple image with Dreamweaver CC map.

    I'm in Design view and have a simple flowchart that I would have on my site with each network diagram box with a link to an additional page with more depth on the subject content.

    If I click on the image in live view, the properties toolbar does not show the part of image map (see first image).

    Capture1.PNG

    However, if I click on the code from the image map controls appear (see the second image).

    Capture2.PNG

    Now, behold, where the question is...

    If I click on the rectangular selection tool in the map properties bar and then try to select the portion of the image to have a point of access/link; the part of the map of the toolbar disappears and returns to the appearance of the first view?

    Therefore, I can't make a selection or create the HotSpot...?

    Please help with advice you may have.

    The site is responsive, and I decided to recreate this image as an SVG, so that it can scale - with a sensitive site, but I just want to experiment with the layout before generating the final graph.

    Thanks for any help you may have!

    Problem is that you are in LIVE view mode.  Switch to DESIGN view for working with image maps.

    What happened to the use of SVG for your tree?

    Nancy O.

  • Problem with creating organization assignment

    Hi all

    I wanted to give permission to create the Organization to a role in OIM 11 g. Its cities on the link: http://docs.oracle.com/cd/E17904_01/doc.1111/e14316/role_mangmnt.htm

    the DIRECTORS of ORGANIZATION IDENTITY of IOM default role is the role that is used to grant this permission to any user. But the problem is that I can't find this default role in the roles of IOM. I don't have IDENTITY USERS ADMINISTRATORS but not for organizations. Can someone ' a please guide me as to what exactly am I missing here?

    Thank you
    $id

    Try again with the role of OPERATOR

    To customize permissions, click on the link given in my post above

  • problems with creating a subpage template

    Hello

    I have a question and would appreciate your help please.

    I created a model with common elements of my pages, including global navigation header and footer, when I try to create a subpage of the template and save it in a different folder as index.php one image now appears in the new index.php file.what should I do to solve this problem, thank you.

    loopy22

    Well the lem prob here is that you have a path relative to the document on this image:

    images/emusicdownloadslogo.gif"
    
    change it to root-relative:
    
    /images/emusicdownloadslogo.gif"
    
    and you'll be good to go.
    
    However, you had said that this page was created as a Child of a DW Template, however this page has no such code.
    
    It was not created as a Child page of a DW Template.  So not sure why you think it is.  Perhaps you mean thatyou copied a page you are calling a "template" in one folder and pasted that code into a new page in another folder?
    
    -- 
    
    E. Michael Brandt
    
    www.divahtml.comwww.divahtml.com/products/scripts_dreamweaver_extensions.phpStandards-compliant scripts and Dreamweaver Extensions
    
    www.valleywebdesigns.com/vwd_Vdw.aspJustSo PictureWindowJustSo PhotoAlbum, et alia
    
    --
    
  • Problem with creating a container with the single line of text

    Hi ~
    I'm overwhelmed with a following problem.
    Problem: I need to create a container with a single line of text. As I learn from the TLF API, there is no way to do that so he left only in a way that looks like this:

    Assuming that textFlow object is to create
    var container: Sprite = new Sprite();
    var width: Number = 500; It has specified the value
    var height: Number = 300; just estimate is sufficient for a normal line height
    var controller: DisplayObjectContainerController = new DisplayObjectContainerController (container, width, height);
    controller.verticalScrollPolicy = ScrollPolicy.OFF;

    textFlow.flowComposer.addController (controller); textFlow.flowComposer.composeContainer (textFlow.flowComposer.getControllerIndex (controlled r));

    find the first line of the top in the created container
    var textFlowLine:TextFlowLine = textFlow.flowComposer.findLineAtPosition (controller.absoluteStart, false);
    var calLineHeight:Number = textFlowLine.textHeight + 8; 8 this is just a test value
    controller.setCompositionSize (width, calLineHeight);
    textFlow.flowComposer.updateContainer (_textFlow.flowComposer.getControllerIndex (Controller));


    In this way, she first calculate first line height giving enough space for the controller
    and cope, after that there adjust the height of the container again and then updates.
    It's so fresh generals I guess

    If anyone has more simple or just how?

    In regards to a single line. I think you can set the lineBreak on the TextFlow to "explicit". In this case lines only break to return to the line and the point ends.

    If you want to be changed, take a look at the TextLineFactory APIs. NaN set in the width/height of the limit and it gets filled. It is a more lightweight way to create TextLines.

    Take a look at the properties DisplayObjectContainerControllers compositionWidth and compositionHeight full TextFlows as in your code using. You still want to use explicit line breaks.

    Hope that helps!
    Richard

  • I have a problem with creating a Xbox account.

    Original title: creating an Xbox account

    I tried to make an Xbox Live account, so I can use my Xbox music app. Yet, whenever I'm almost done with the Xbox account-creation-process told me to create a Windows Live account, and then come back to xbox.com. Since I already have an I sign in and then return to xbox.com. But Xbox told me always to create an account! I went through this process of signature on my account at least 15 times. What should I do to correct that?

    Hello again,

    Looks like you need to get Xbox support to get this configuration for you. Here is a link:

    http://www.Xbox.com/en-us/forums

  • Problem with 'Create new Extrusion of the selected layer' CC 2014

    Hello, I am experienced with Photoshop but I'm new to 3D text in Photoshop.  I type the text and convert it to a form.  When I choose to create new Extrusion of the selected layer I get the dialog, I don't see in tutorials.  It says "you are about to create a 3D layer.  You want to switch to the 3D workspace?  Yes/No, do not display again. "Which one should I use for the 3D text?

    If I choose Yes, all the panels disappear and the content in the tool options bar (Ribbon?) just under the menu bar disappears.  I have to restart Photoshop to get back on the tool options.  What could I do it wrong?

    Thanks - Dave

    I just chose 'No' and don't look at back.  I love my workspace, just as it is and doesn't prefer Photoshop to change for me in this case especially.

    You bring up the 3D Panel yourself via the window - 3D.  I think it's a good alternative for the Actions Panel, because I don't have any currently working in the 3D world.

    You'll want to see easily if you are working on 3D are 3D Panel and panel properties, among a few others.

    Regarding return your workspace as you like it...  Note the small switch near the upper right of the main window of Photoshop.  That can be used to select a workspace.  I suggest that you experiment and familiarize yourself with the concept of workspaces.  You can set your own and save it with a name, and that can really be useful.

    -Christmas

Maybe you are looking for