transfer of constraint in CREATE TABLE as subquery

I tried to create a table of subquery that involves the join operation. tables:
create table t1(
col1 number
,col2 number
,col3 varchar2(50) not null
,constraint ck check(col2>col1)
)
create table t2(
col1 number
,col2 number
,col3 varchar2(100) not null
,constraint ck1 check(col2l>100)
)
create table composite as select * from t1 left join t2 using(col1,col2)
I checked the constraints trained in composite table and only the stress level in t1.col3 attribute is copied. What about other constraints? are they excluded because they are forced to table level? Thank you

Published by: 801264 on November 27, 2010 04:07

NOT only the constraints apply NULL to the DEC and even they are applied according to the type of join or / and expression. In your case t2.col3 of column is NOT NULL, however, the corresponding column in the composite table would be NULL since LEFT JOIN implies a null value when no match on col1 is found. Same way any expression against t1.col3 would result in a column that can be null in the composite table.

SY.

Tags: Database

Similar Questions

  • create table as subquery

    I can add the foreign key constraint and create a
    table using the subquery?

    Like this

    create table emp
    that select department_id references departments (department_id)
    employees

    This is the syntax of wright or I can do this only by the alter command?

    987018 wrote:
    I can add the foreign key constraint and create a
    table using the subquery?

    Lol you need to create table and then issue ALTER TABLE to create the FK.

    SY.

  • Privilege system to create constraints on the Tables belong not to the

    I'm a user of the application who must create and then drop a check constraint on a table that is partitioned in another schema. The code is generic, and the name or the table owner is not known in advance.

    The user of the application has the ALTER ANY TABLE system privilege granted via a role, and also has "all THE ' table privileges on the table, THE DML privs, SELECT, REFERENCES etc. - also through roles. The user of the application has a synonym private for the data table.

    The command I use is:

    ALTER TABLE any_table
    ADD CONSTRAINT generated_name
    CHECK (CASE WHEN BUSINESS_DATE = TO_DATE('20121130','YYYYMMDD') AND = 6 AND PROCESSING_LOCATION = "CAP" RUN_ID THEN 1 OTHER 2 END = 2);

    It fails with:

    ORA-00942: table or view does not exist

    The user of the application can query the table very well and even modify it to partition exchange using a similar code. I tried the table name and the name of constraint qualification with the owner of the schema; calling the makes table name no difference, by qualifying the name of the constraint is not allowed. I changed the body of the constraint to a simple condition - it predictable made no difference.

    I would appreciate your help and your suggestions.

    Has nothing to do with privileges. ALTER TABLE requires the name of the table. Synonym will not fly. Use:

    ALTER TABLE table_owner.table_name
    ADD CONSTRAINT generated_name
    CHECK( CASE WHEN BUSINESS_DATE = TO_DATE('20121130','YYYYMMDD') AND RUN_ID = 6 AND PROCESSING_LOCATION = 'PAC' THEN 1 ELSE 2 END = 2);
    

    SY.

  • creating table using joins in the subquery

    can we create a table using joins in the subquery?
    Like this
    create table emp in select * from employee e, Department d
    where d.department_id = e.department_id
    ??
    We can?

    987018 wrote:
    We can?

    Yes, as long as you column alias names common to both tables to make them unique.

    SY.

  • How to create a foreign key constraint on a table nested column

    Dear Experts,
    I create 2 tables using the object type. the VESSEL_PARAM table contains the list of the parameters allowed.
    The table VESSEL_TYPE containe single item we list some parameters.

    On this table, I love the column VESSEL_PARAM table VESSEL_PARAM to check if the settings are and the reference value is allowed.
    How to create a foreign key?
    Here my script that generates this runtime error: 00904. 00000 - '% s: invalid identifier' on this line

    ALTER TABLE VESSEL_PARAM_TAB ADD CONSTRAINT FK_VESSEL_TYPE FOREIGN KEY (NAME, DATA_VALUE)
    REFERENCES VESSEL_PARAM (PARAM_NAME, LIST_PARAM_VALUE. DATA_VALUE)
    CREATE OR REPLACE TYPE OBJ_PARAM_VALUE AS OBJECT 
    ( 
      DATA_VALUE  VARCHAR2(20)
     ,DESCRIPTION VARCHAR2(125)
    ) NOT FINAL;
    /
    
    CREATE OR REPLACE TYPE LIST_PARAM_VALUE AS TABLE OF OBJ_PARAM_VALUE;
    /
    
    -- derive object subtype from object supertype
    CREATE OR REPLACE TYPE OBJ_PARAM_NAME UNDER OBJ_PARAM_VALUE (
      NAME VARCHAR2(30)
    )NOT FINAL;
    /
    
    CREATE OR REPLACE TYPE LIST_PARAM_NAME AS TABLE OF OBJ_PARAM_NAME;
    /
    
    Prompt create table VESSEL_PARAM;
    CREATE TABLE VESSEL_PARAM (
       PARAM_NAME   VARCHAR2(20) NOT NULL
      ,PARAM_DESC   VARCHAR2(125)
      ,PARAM_VALUE  LIST_PARAM_VALUE
      ,CONSTRAINT PK_VESSEL_PARAM PRIMARY KEY (PARAM_NAME)
    ) 
    NESTED TABLE PARAM_VALUE STORE AS PARAM_VALUE_TAB
    TABLESPACE CMS_ADMDATA;
    /
    ALTER TABLE PARAM_VALUE_TAB ADD CONSTRAINT UN_PARAM_VALUE_TAB UNIQUE (DATA_VALUE);
    /
    SHOW ERROR;
    
    Prompt create table CMS_ADM.VESSEL_TYPE;
    CREATE TABLE CMS_ADM.VESSEL_TYPE (
      VESSEL_TYPE  VARCHAR2(20) NOT NULL
     ,VESSEL_DESC  VARCHAR2(125)
     ,VESSEL_PARAM LIST_PARAM_NAME
     ,CONSTRAINT PK_VESSEL_TYPE PRIMARY KEY (VESSEL_TYPE)
    -- ,CONSTRAINT FK_VESSEL_TYPE FOREIGN KEY (VESSEL_PARAM) 
    --        REFERENCES VESSEL_PARAM (PARAM_NAME)
    ) 
    NESTED TABLE VESSEL_PARAM STORE AS VESSEL_PARAM_TAB
    TABLESPACE CMS_ADMDATA;
    /
    ALTER TABLE VESSEL_PARAM_TAB ADD CONSTRAINT UN_VESSEL_PARAM_TAB UNIQUE (NAME);
    ALTER TABLE VESSEL_PARAM_TAB ADD CONSTRAINT FK_VESSEL_TYPE FOREIGN KEY (NAME,DATA_VALUE) 
            REFERENCES VESSEL_PARAM (PARAM_NAME,LIST_PARAM_VALUE.DATA_VALUE)
    /
    SHOW ERROR;
    Thank you

    Salvatore

    Could you please indicate your answer as correct if you judge them correct.

    Best regards

    Mohamed Houri

  • 'Create table' is not possible with Jet.OLEDB.4.0

    I use LabVIEW Toolkit DB to access databases.

    I opened an access database of microsoft with the connection string "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\test3.accdb".

    When I exeucted

    create table leq_octave_5min (recorded_time DATETIME CONSTRAINT PRIMARY KEY pk1,
    Leq5 LEQ5 FLOAT NOT NULL CONSTRAINT,
    Min MIN FLOAT NOT NULL CONSTRAINT,
    Max MAX FLOAT NOT NULL CONSTRAINT,
    L05 FLOAT L05 CONSTRAINT NOT NULL,.
    L10 FLOAT L10 CONSTRAINT NOT NULL,.
    L50 FLOAT L50 CONSTRAINT NOT NULL,.
    L.90 L.90 FLOAT CONSTRAINT NOT NULL,
    L95 FLOAT L95 CONSTRAINT NOT NULL,.
    Us01 us01 FLOAT NOT NULL CONSTRAINT,
    EN02 EN02 FLOAT NOT NULL CONSTRAINT,
    Fr03 FR03 FLOAT NOT NULL CONSTRAINT,
    Fr04 fr04 FLOAT NOT NULL CONSTRAINT,
    Fr05 fr05 FLOAT NOT NULL CONSTRAINT,
    Fr06 fr06 FLOAT NOT NULL CONSTRAINT,
    Fr07 fr07 FLOAT NOT NULL CONSTRAINT,
    Fr08 FR08 FLOAT NOT NULL CONSTRAINT,
    Fr09 FR09 FLOAT NOT NULL CONSTRAINT,
    Fr10 fr10 FLOAT NOT NULL CONSTRAINT,
    Fr11 FR11 FLOAT NOT NULL CONSTRAINT,
    Fr12 FR12 FLOAT NOT NULL CONSTRAINT,
    Fr13 FR13 FLOAT NOT NULL CONSTRAINT,
    Fr14 FR14 FLOAT NOT NULL CONSTRAINT,
    Fr15 FR15 FLOAT NOT NULL CONSTRAINT,
    Fr16 FR16 FLOAT NOT NULL CONSTRAINT,
    Fr17 FR17 FLOAT NOT NULL CONSTRAINT,
    Fr18 FR18 FLOAT NOT NULL CONSTRAINT,
    Fr19 FR19 FLOAT NOT NULL CONSTRAINT,
    Fr20 FR20 FLOAT NOT NULL CONSTRAINT,
    Fr21 FR21 FLOAT NOT NULL CONSTRAINT,
    Fr22 FR22 FLOAT NOT NULL CONSTRAINT,
    E23, e23 FLOAT NOT NULL CONSTRAINT,
    Fr24 FR24 FLOAT NOT NULL CONSTRAINT,
    Fr25 fr25 FLOAT NOT NULL CONSTRAINT,
    Fr26 FR26 FLOAT NOT NULL CONSTRAINT,
    Fr27 fr27 FLOAT NOT NULL CONSTRAINT,
    Fr28 FR28 FLOAT NOT NULL CONSTRAINT,
    Fr29 FR29 FLOAT NOT NULL CONSTRAINT,
    Fr30 FR30 FLOAT NOT NULL CONSTRAINT,
    status TEXT (2) st NOT NULL CONSTRAINT)

    I got an error saying "error ADO: 0x80040E14.

    I have not had any problems with an ODBC driver.

    Why make such a mistake with Jet OLE DB?

    A web page was told that MIN and MAX are reserved words of Jet 4.0.

    So I defined with [and].

    Then, after it works.

  • using datediff, creating table

    Hi all

    I'm trying to calculate the number of years of a product when a new record is inserted.

    That's what I tried

    CREATE TABLE WaterMeter)

    meterID VARCHAR (25) NOT NULL,

    readingID VARCHAR (25) NOT NULL,

    meterSerialNum VARCHAR (25) NOT NULL,

    installationDate DATE NOT NULL,

    noOfYears AS (DATEDIFF (YEAR, sysdate, installationDate));

    CONSTRAINT watermeter_Pkey PRIMARY KEY (meterID).

    Watermeter_Altkey of UNIQUE CONSTRAINT (meterSerialNum)

    );

    and the following error appeared.

    Error in the command line column: 6:27

    Error report:

    SQL error: ORA-00904: "YEAR": invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    so, how can I go around to solve this issue?

    Virtual column is... virtual. It is not stored in the table. Oracle calculates the value of virtual column every time that reference you it. This is why you cannot use functions such as SYSDATE in a virtual column expression. I understand the logic underlying your table, but this is done using views. Simply create the table without column of noOfYears, then

    create or replace view WaterMeter_VW as select t.*, MONTHS_BETWEEN (sysdate, installationDate) / 12 WaterMeter noOfYears t;

    SY.

  • ORA-00905 in Create Table

    Hello

    I create 2 APEX table with foreign key; the first table is OK, but in the second table, I get an error "ora-00905 keyword missing."

    This is the statement:

    "

    -- -----------------------------------------------------

    -Table "PATRIMONIO." 'SCHEDA_ANAGRAFICA '.

    -- -----------------------------------------------------

    CREATE TABLE SCHEDA_ANAGRAFICA (

      ID_SCHEDA VARCHAR (20) NOT NULL ,

      MUNICIPIO VARCHAR (45) NULL ,

      ADDRESS VARCHAR (45) NULL ,

    DIP_CONSEGANTARIO VARCHAR()45() NULL

      DETAILS VARCHAR (45) NULL ,

      TIPOLOGIA VARCHAR (45) NULL ,

    DESCR_IMMOBILE VARCHAR()90) NULL

      PRIMARY KEY (ID_SCHEDA) );

    -- -----------------------------------------------------

    -Table "PATRIMONIO." 'SCHEDA_AMMINISTRATIVA '.

    -- -----------------------------------------------------

    CREATE TABLE SCHEDA_AMMINISTRATIVA (

      ID_SCHEDA VARCHAR (20) NOT NULL ,

    DESCR_TRASFERIMENTO VARCHAR()45() NOT NULL

    NOTA_TRASCRIZIONE VARCHAR()45() NULL

      ASSEGNAZIONE VARCHAR (45) NULL ,

      VERB_CONSEGNA VARCHAR (45) NULL ,

      CONCESSIONE VARCHAR (45) NULL ,

      NOTE                VARCHAR (45) NULL ,

    PRIMARY KEY ( )ID_SCHEDA DESCR_TRASFERIMENTO)

    Fk_AMMINISTRATIVA_ANAGRAFICA of the CONSTRAINT

        FOREIGN KEY (ID_SCHEDA)

    REFERENCES SCHEDA_ANAGRAFICA ()ID_SCHEDA( )

    WE REMOVE ANY ACTION

        ON UPDATE NO ACTION );

    "

    I don't understand the cause.

    Can you help me?

    Thank you

    5fd006d0-5573-4a0f-821a-63f2bd8083fd wrote:

    Please update your forum profile with a real handle instead of '5fd006d0-5573-4a0f-821a-63f2bd8083fd '.

    I create 2 APEX table with foreign key; the first table is OK, but in the second table, I get an error "ora-00905 keyword missing."

    You create tables in the Oracle RDBMS, not by their SUMMIT. APEX is a development tool, not a database.

    This is the statement:

    "

    -- -----------------------------------------------------

    -Table "PATRIMONIO." 'SCHEDA_ANAGRAFICA '.

    -- -----------------------------------------------------

    CREATE TABLE SCHEDA_ANAGRAFICA)

    ID_SCHEDA VARCHAR (20) NOT NULL,

    NULL IN MUNICIPIO OF VARCHAR (45).

    ADDRESS VARCHAR (45) NULL,

    DIP_CONSEGANTARIO VARCHAR (45) NULL,

    DETAILS VARCHAR (45) NULL,

    TIPOLOGIA VARCHAR (45) NULL,

    DESCR_IMMOBILE VARCHAR (90) NULL,

    PRIMARY KEY (ID_SCHEDA));

    -- -----------------------------------------------------

    -Table "PATRIMONIO." 'SCHEDA_AMMINISTRATIVA '.

    -- -----------------------------------------------------

    CREATE TABLE SCHEDA_AMMINISTRATIVA)

    ID_SCHEDA VARCHAR (20) NOT NULL,

    DESCR_TRASFERIMENTO VARCHAR (45) NOT NULL,

    NOTA_TRASCRIZIONE VARCHAR (45) NULL,

    ASSEGNAZIONE VARCHAR (45) NULL,

    VERB_CONSEGNA VARCHAR (45) NULL,

    CONCESSIONE VARCHAR (45) NULL,

    NOTE VARCHAR (45) NULL,

    PRIMARY KEY (ID_SCHEDA, DESCR_TRASFERIMENTO).

    CONSTRAINT fk_AMMINISTRATIVA_ANAGRAFICA

    FOREIGN KEY (ID_SCHEDA)

    REFERENCES SCHEDA_ANAGRAFICA (ID_SCHEDA)

    ON DELETE NO ACTION

    UPDATE NO ACTION);

    "

    I don't understand the cause.

    Ni NO ACTION or ON UPDATE are valid in a REFERENCES clause in Oracle. If you want to default to make referential integrity checks can remove these clauses. The only other options are ON DELETE CASCADE/SET NULL.

  • How can I Data Modeler does not generate constraints on NNC_ tables?

    Hi all

    Unfortunately I have not found the answer using Google ;-)

    When I generate my DDL scripts on my model on some tables Data Modeler (version 4.0.0) automatically generates constraints on the columns of the table "NNC_" for example:

    CREATE TABLE STG_DURCHGANGSKNOTEN

    (

    ID NUMBER CONSTRAINT NNC_STG_DURCHGANGSKNOTENv1_ID NOT NULL,

    Kilometrierung VARCHAR2 (20) CONSTRAINT NNC_STG_DURCHGANGSKNOTENv1_Kilometrierung NOT NULL,

    Letzte_Aenderung DATE CONSTRAINT NNC_STG_DURCHGANGSKNOTENv1_Letzte_Aenderung NOT NULL,

    Knotentyp VARCHAR2 (100) CONSTRAINT NNC_STG_DURCHGANGSKNOTENv1_Knotentyp NOT NULL,

    Name VARCHAR2 (100),

    BZ_Bezeichner VARCHAR2 (100),

    GUI_Bezeichner VARCHAR2 (100),

    Spurplanabschnitt_ID NUMBER NNC_STG_DURCHGANGSKNOTENv1_Spurplanabschnitt_ID CONSTRAINT NOT NULL,.

    XML_Document XMLTYPE

    );

    How can I avoid this? I like to just get something like this:

    CREATE TABLE STG_DURCHGANGSKNOTEN

    (

    IDENTIFICATION NUMBER NOT NULL,

    Kilometrierung VARCHAR2 (20) NOT NULL,

    Letzte_Aenderung DATE NOT NULL,

    Knotentyp VARCHAR2 (100) NOT NULL,

    Name VARCHAR2 (100),

    BZ_Bezeichner VARCHAR2 (100),

    GUI_Bezeichner VARCHAR2 (100),

    Spurplanabschnitt_ID NUMBER NOT NULL,

    XML_Document XMLTYPE

    );

    Thank you

    Matthias

    Hi Matthias,

    The NOT NULL Constraint clause appears likely because 'Not Null Constraint Name' property is set to the column.  (It is indicated on the Panel "forced by default and ' in the column properties dialog box.)

    To stop these products, you can go to the Data Modeler/DOF of the preferences page (on the Tools menu) and set the option 'generate short form of NO forced NULL.

    Note that there now is a forum specifically for the Data Modeler: SQL Developer Data Modeler

    David

  • Please let me know how I can add a new column with a constraint not null, table already has data, without falling off the table... Please help me on this issue...

    Hello

    I have an emp_job_det with a, b, c columns table. Note that this TABLE ALREADY has DATA OF THESE COLUMNS

    IAM now add a new column "D" with forced not null

    Fistly I alter the table by adding the single column "D", if I do, the entire column would be created with alll of nulls for the column DEFAULT D

    ALTER table emp_job_det Add number D; -do note not null CONSTRAINT is not added

    Second... If I try to add the constraint not null, get an eoor as already conatained null values...

    (GOLD)

    In other words, if I put the query

    ALTER table emp_job_det Add number D NOT NULL; -THROWS ERROR AS TABLE ALREADY CONTAINS DATA

    So my question is how how can I add a new column with a constraint not null, table already has the data, without falling off the table

    Please help me on this issue...

    Add the column without constraint, then fill the column. Once all the rows in the table are given in the new column, and then add the constraint not null.

  • Lack of good parent when creating table.

    I get the "ORA-00907: lack the right parenthesis" error when creating the table with the following code.

    create the table SALES_ORDER
    (
    Check the primary key to the ORDERNO varchar2 (6) (ORDERNO like '% O'),
    CLIENTNO varchar2 (6) references to foreign keys CLIENT_MASTER (CLIENTNO),
    ORDERDATE date not null,
    DELYADDR varchar2 (25).
    SALESMANNO varchar2 (6) foreign refers to SALESMAN_MASTER (SALESMANNO).
    DELYTYPE char (1) default 'F' tick (DELYTYPE IN ('P', 'F')),
    BILLYN char (1),
    Check date DELYDATE (DELYDATE > = ORDERDATE).
    Verification of varchar2 (10) ORDERSTATUS (ORDERSTATUS IN ('In Process ',' Fulfilled ',' BackOrder ',' Cancelled'))
    );

    What I am doing wrong?

    1003332 wrote:
    I get the "ORA-00907: lack the right parenthesis" error when creating the table with the following code.

    create the table SALES_ORDER
    (
    Check the primary key to the ORDERNO varchar2 (6) (ORDERNO like '% O'),
    CLIENTNO varchar2 (6) references to foreign keys CLIENT_MASTER (CLIENTNO),
    ORDERDATE date not null,
    DELYADDR varchar2 (25).
    SALESMANNO varchar2 (6) foreign refers to SALESMAN_MASTER (SALESMANNO).
    DELYTYPE char (1) default 'F' tick (DELYTYPE IN ('P', 'F')),
    BILLYN char (1),
    Check date DELYDATE (DELYDATE > = ORDERDATE).
    Verification of varchar2 (10) ORDERSTATUS (ORDERSTATUS IN ('In Process ',' Fulfilled ',' BackOrder ',' Cancelled'))
    );

    What I am doing wrong?

    Try

    create table SALES_ORDER
    (
    ORDERNO varchar2(6) Primary key check(ORDERNO like 'O%'),
    CLIENTNO varchar2(6) ,
    ORDERDATE date not null,
    DELYADDR varchar2(25),
    SALESMANNO varchar2(6) ,
    DELYTYPE char(1) default 'F' check(DELYTYPE IN('P','F')),
    BILLYN char(1),
    DELYDATE date,
    ORDERSTATUS varchar2(10) check(ORDERSTATUS IN('In Process','Fulfilled','BackOrder','Cancelled')),
    foreign key (clientno) references CLIENT_MASTER(CLIENTNO),
    foreign key (salesmanno) references SALESMAN_MASTER(SALESMANNO)
    );
    

    I removed the audit on delydate that you cannot refer to another column in a constraint check (at the level of the column). You can to the table level.

    Published by: Paul Horth on April 30, 2013 14:57
    Updated to clarify where the verification of the cross-column can happen (more coffee needed!)

  • SQL authentication provider - create table script

    Hi all!
    I would use the SQL provider for my Web application authentication. I can't find the script to create tables of users/roles used by the provider.
    Can you suggest me a link where I can download?
    Thank you
    Frank

    Hi Frank,.

    Configure the SQL authenticator:

    Start Oracle XE DB and open propmt SQL to run commands below:

    CREATE TABLE USERS)
    U_NAME VARCHAR (200) NOT NULL,
    U_PASSWORD VARCHAR (50) NOT NULL,
    U_DESCRIPTION VARCHAR (1000))
    ;
    ALTER TABLE USERS
    ADD CONSTRAINT PK_USERS
    PRIMARY KEY (U_NAME)
    ;
    CREATE TABLE GROUPS)
    G_NAME VARCHAR (200) NOT NULL,
    G_DESCRIPTION VARCHAR (1000) NULL)
    ;
    ALTER TABLE GROUPS
    ADD CONSTRAINT PK_GROUPS
    PRIMARY KEY (G_NAME)
    ;
    CREATE TABLE GROUPMEMBERS)
    G_NAME VARCHAR (200) NOT NULL,
    G_MEMBER VARCHAR (200) NOT NULL)
    ;
    ALTER TABLE GROUPMEMBERS
    ADD CONSTRAINT PK_GROUPMEMS
    (PRIMARY KEY)
    G_NAME,
    G_MEMBER
    )
    ;
    ALTER TABLE GROUPMEMBERS
    ADD CONSTRAINT FK1_GROUPMEMBERS
    FOREIGN KEY (G_NAME)
    REFERENCE (G_NAME) GROUPS
    ON DELETE CASCADE

    Generally, customers can add users directly in DB with help commands below:

    insert into USERS (U_NAME, U_PASSWORD, U_DESCRIPTION) values ('system', 'weblogic', 'user admin');
    insert into GROUPS (G_NAME, G_DESCRIPTION) values ('Administrators', 'Administrators');
    insert into values('Administrators','system') GROUPMEMBERS (G_NAME, G_MEMBER);

    But in this case is not encrypted password then, either you can add users via the console or WLST script to be stored in encrypted form.

    We had performed above commands just to check that the user that is stored directly in the DB gets properly authenticated or not configured SQL authenticator as below

    Now start weblogic admin server and console access to create the data source by the navigation Services-> JDBC-> data sources

    Create the data source named SqlDS

    JNDI: SqlDS

    Type of DB: Oracle

    : DB driver Oracle Thin XA

    Name of the data base: XE

    DB host:

    Port: 1521

    DB user:

    DB password:

    Even the rest of the configuration and click test Configuration. If its success click on next and it targets to "AdminServer.

    Click Finish and activate chnages

    Now navigate to the areas of security-> myrealm-> suppliers

    Click new and supply the names of SqlAuthenticator and select Type of SQLAuthenticator

    Now click on newly created provider and make the indicator of control as "sufficient".

    Go to the specific page of provider:

    1. check on cleartext passwords enabled.

    2. provide a data name source: SqlDS

    Keep the rest of the parameters it is and save this configuration. It will ask you to restart the management server.

    Now, again navigate areas of security-myrealm-> users & groups >

    User created directly in the DB control is listed in the table with SqlAuthenticator, once its list, go ahead and add users as below

    B. Cretae users using the administration console:

    Sign in to the administration console

    Access areas of security-myrealm-> users & groups >

    Click the users tab and try to create the new user

    User name:

    Select authentication provider: SqlAuthenticator

    User password:

    Once the table DB check creating user, this user added with password encypted musted

    C. create multiple users using WLST script:

    File Navigave of $DOMAIN_HOME/bin and run the file setDomainEnv as below:

    UNIX:. ./setDomainEnv.sh (don't forget to put two points before /)

    Windows: setDomainEnv.cmd

    Now, change script depending on your environment below and run as suggested in step 3:

    Connect('weblogic','weblogic123','t3://localhost:7001')
    Edit()
    startEdit(-1,-1,'false')
    serverConfig()
    CD('/SecurityConfiguration/base_domain/Realms/MYREALM/AuthenticationProviders')
    ls()
    CD ('SqlAuthenticator')
    cmo.createUser ('vaishali', 'weblogic123', 'SQLuser')

    cmo.createUser ('pavashe', 'weblogic123', 'SQLuser')
    Edit()
    stopEdit('y')

    NOTE: Change username, password, and ADMIN_URL in 1st line.

    Replace the domain name "base_domain" by your domain online no.: 5

    Authenticator name change SQL online no: 6 by your authenticator name

    Next lines create users. You need to add however to users, you need to create programmatically.

    Syntax: cmo.createUser ('user_name', 'user_password', 'user_description')

    Now, to save these commands in a file with the extension .py and run as below:

    # java weblogic. WLST create_user.py

    If your script does not have to try running each command separately. For this session WLST beginning as below:

    # java weblogic. WLST

    Now run above commands in the script. You will be able to debug if something went wrong during execution of script.

    Kind regards
    Kal

  • Computed in a Create table columns

    It's my create table statement:

    CREATE TABLE DTPartInv
    (partinv_partnbr VARCHAR2 (10) NOT NULL,)
    partinv_prodname VARCHAR2 (25).
    partinv_desc VARCHAR2 (25).
    partinv_manufact VARCHAR2 (25).
    partinv_instock INTEGER NOT NULL,
    partinv_category VARCHAR2 (20).
    partinv_purchdate DATE,
    partinv_loc VARCHAR2 (15).
    partinv_price NUMBER (6.2),
    partinv_vendor VARCHAR2 (20).
    partinv_reorder INTEGER NOT NULL,
    partinv_serial VARCHAR2 (20).
    partinv_flag as (case when partinv_instock < partinv_reorder then 'X' else 'o' end), calculated column
    CONSTRAINT DTPartInv_partinv_partnbr_pk
    PRIMARY KEY (partinv_partnbr)
    );

    and here's my Insert into table instructions:
    INSERT INTO DTPartInv VALUES ('XT40010E', 'TMC Inc', 2, Null, 'Exhaust' 'pipes', TO_DATE (11 April 10 ',' DD-MON-RR'), Null, 45.95, 'Oracle Auto Parts', 1, Null);
    INSERT INTO DTPartInv VALUES ('CH9260', Null, 'oil filter', 'Mechanical parts', 5, 'Fuild filters', TO_DATE (15 January 10 ',' DD-MON-RR'), Null, 20.00, "wells auto P", 2, Null);
    INSERT INTO DTPartInv VALUES ('15W40', Null, ' oil ',' sink the oil ', 20, 'Auto Fuilds', TO_DATE (February 10, 11 ',' DD-MON-RR'), Null, 10.00, "Oracle Auto Parts", 5, Null,);
    INSERT INTO DTPartInv VALUES ('C9262', Null, 'fuel filter', 'Mechanical parts', 2, 'Fuild filters', TO_DATE (October 20, 10 ',' DD-MON-RR'), Null, 35.95, 'sink Auto Parts', 1, Null);
    INSERT INTO DTPartInv VALUES ('PS7716', Null, ' Fuel/water separator', 'Parts', 4, 'Fuild filters', TO_DATE (December 9, 10 ',' DD-MON-RR'), Null, 50.00, 'sink Auto Parts', 1, Null);
    INSERT INTO DTPartInv VALUES ('800142', Null, 'Valve PPI', 'Beink pipes Inc.', 10, 'Valves', TO_DATE (June 1, 11 ',' DD-MON-RR'), Null, 20.00, 'Oracle Auto Parts', 2, Null);
    INSERT INTO DTPartInv VALUES ('TTS400', 'Clip Butt', Null, 'Beink pipes Inc.', 10, 'Valves', TO_DATE (October 31, 11 ',' DD-MON-RR'), Null, 15.95, 'Oracle Auto Parts', 2, Null);
    INSERT INTO DTPartInv VALUES ('TBA400', 'Clamp Lap', Null, 'Beink pipes Inc.', 10, 'Valves', TO_DATE (November 10, 11 ',' DD-MON-RR'), Null, 30.00, 'Oracle Auto Parts', 2, Null);
    INSERT INTO DTPartInv VALUES (Null, mechanical parts "Brake pads',"Mechanical CostVB", 5,", 'SC16650', TO_DATE (May 15, 11 ',' DD-MON-RR'), Null, 60.00, 'Adosql Auto Parts', 1, Null);
    INSERT INTO DTPartInv VALUES ('OB46613', Null, 'emergency door latch", 'Mechanical CostVB', 3, 'Mechanical parts', TO_DATE ('01 - sept.-11 ',' DD-MON-RR'), Null, 45.95, 'Adosql Auto Parts', 1, Null);

    And this is a sample of the error, I can test:
    INSERT INTO DTPartInv VALUES ('XT40010E', 'TMC Inc', 2, Null, 'Exhaust' 'pipes', TO_DATE (11 April 10 ',' DD-MON-RR'), Null, 45.95, 'Oracle Auto Parts', 1, Null)
    ERROR on line 1:
    ORA-00947: not enough values

    I need to understand what it is that I'm missing here. partinv_flag is supposed to be calculated according to partinv_instock and partinv_reorder.

    Hello

    Review the syntax for virtual columns in the manual of the SQL language:
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e26088/statements_7002.htm#sthref5146

    You want something like this (showing only the relevant columns):

    CREATE TABLE DTPartInv
    (
         partinv_instock          INTEGER          NOT NULL
    ,     partinv_reorder          INTEGER          NOT NULL
    ,     partinv_flag           VARCHAR2 (1)      AS ( CASE
                                            WHEN  partinv_instock < partinv_reorder
                                           THEN 'X'
                                              ELSE 'O'
                                        END
                                     )
    );
    
    INSERT INTO DTPartInv (partinv_instock, partinv_reorder) VALUES (100, 100);
    

    Announcing the column names until the VALUES of Word key is a good idea in any case, and it is needed when you have virtual columns.

  • [10g] calls for more information on CREATE TABLE?

    Is it possible to put something in place that invites you to insert a piece of information at any time a table is created?

    I have a table:
    CREATE TABLE     my_table_notes
    (     table_name     VARCHAR2(30)     NOT NULL
    ,     table_owner     VARCHAR2(3)     NOT NULL
    ,     date_added     TIMESTAMP     NOT NULL
    ,     notes          VARCHAR2(2000)
    ,     CONSTRAINT     dtn_pk     PRIMARY KEY (table_name, table_owner, date_added)
    );
    Where do I put the notes on the tables, that I added to my database. These notes are mainly to remind me exactly what is in the tables. I have a number of tables with similar names and similar columns, such as desc table does not always information that I need to remember what is a table. Yes, I could keep a document text or something with this information, but I like to have in the database.

    What I was asking is, is there anything I can do which will automatically ask me after I created a table, in order to enter comments on this table, such as the instruction insert the following would be generated?
    INSERT INTO     my_table_notes
    VALUES (<table just created>, <owner of table created>, SYSTIMESTAMP, <comments I provide on prompt>);
    I work in 10g (XE on my local machine)

    Published by: user11033437 on July 14, 2011 09:31: Oracle version added

    If you happen to start with serveroutput enabled in SQL * more permanently, a DDL trigger could potentially just released a note reminding you to create a comment. If you do not set serveroutput, you don't see the message. And, of course, you could easily ignore the message that came out. If you want just a friendly reminder, this is enough.

    Because PL/SQL runs on the database server, there is no way to ask a user for something - it has no facilities to get a user input. SQL * Plus has the ability to ask a user for the data, but then you need to run a given SQL * more script to create a table that seems much too heavy for the situation you describe.

    Justin

  • Problem updating multiple rows in the table using subquery

    Hi everyone, I can't update multiple lines with a subquery. Here is the configuration:
    create table mytable (
    col_a number primary key,
    col_b number,
    col_c number,
    col_d number);
    
    insert into mytable values (1 ,1,1,15);
    insert into mytable values (2 ,1,2,7 );
    insert into mytable values (3 ,1,3,11);
    insert into mytable values (4 ,1,4,23);
    insert into mytable values (5 ,1,5,14);
    insert into mytable values (6 ,2,1,50);
    insert into mytable values (7 ,2,2,41);
    insert into mytable values (8 ,2,3,13);
    insert into mytable values (9 ,2,4,12);
    insert into mytable values (10,2,5,19);
    insert into mytable values (11,3,1,10);
    insert into mytable values (12,3,2,92);
    insert into mytable values (13,3,3,81);
    insert into mytable values (14,3,4,17);
    insert into mytable values (15,3,5,66);
    insert into mytable values (16,4,1,54);
    insert into mytable values (17,4,2,41);
    insert into mytable values (18,4,3,22);
    insert into mytable values (19,4,4,24);
    insert into mytable values (20,4,5,17);
    For this example, by using an update statement (or merge if this is better), I mean set values for col_d where col_b = 3 equal to that of the col_d where col_b = 1 and col_c equal between them. Results should resemble the following after the update:
    col_a col_b col_c col_d
    1     1     1     15
    2     1     2     7
    3     1     3     11
    4     1     4     23
    5     1     5     14
    6     2     1     50
    7     2     2     41
    8     2     3     13
    9     2     4     12
    10    2     5     19
    11    3     1     15
    12    3     2     7
    13    3     3     11
    14    3     4     23
    15    3     5     14
    16    4     1     54
    17    4     2     41
    18    4     3     22
    19    4     4     24
    20    4     5     17
    I see her there within my reach using this query, where I want to put b_col_d = a_col_d, but miss me something, this query returns too many rows when it is used in the update statement.
    select * from (
      select col_a as a_col_a, col_b as a_col_b, col_c as a_col_c, col_d as a_col_d
      from mytable
      where col_b = 1
      ) a, (
      select col_a as b_col_a, col_b as b_col_b, col_c as b_col_c, col_d as b_col_d
      from mytable
      where col_b = 3
      ) b
    where a.a_col_c = b.b_col_c
    Update column_d set mytable = (select? where?)

    Can someone help me get there? I use 10 gr 2.

    Thank you!
    Mark

    I hope that's what you're looking for:

    SQL > UPDATE mytable myt1
      2  SET    col_d = ( SELECT myt2.col_d
      3                   FROM   mytable myt2
      4                   WHERE  myt2.col_b = 1
      5                   AND    myt1.col_c = myt2.col_c
      6                 )
      7  WHERE  col_b = 3
      8  AND    EXISTS
      9         ( SELECT NULL
     10           FROM   mytable myt2
     11           WHERE  myt2.col_c = myt1.col_c
     12         )
     13  ;
    
    5 rows updated.
    
    SQL > SELECT * FROM mytable ORDER BY col_a;
    
                   COL_A                COL_B                COL_C                COL_D
    -------------------- -------------------- -------------------- --------------------
                       1                    1                    1                   15
                       2                    1                    2                    7
                       3                    1                    3                   11
                       4                    1                    4                   23
                       5                    1                    5                   14
                       6                    2                    1                   50
                       7                    2                    2                   41
                       8                    2                    3                   13
                       9                    2                    4                   12
                      10                    2                    5                   19
                      11                    3                    1                   15
                      12                    3                    2                    7
                      13                    3                    3                   11
                      14                    3                    4                   23
                      15                    3                    5                   14
                      16                    4                    1                   54
                      17                    4                    2                   41
                      18                    4                    3                   22
                      19                    4                    4                   24
                      20                    4                    5                   17
    
    20 rows selected.
    

    Thank you very much for providing the sample data in a format that is easy to consume form, as well as the expected results.

Maybe you are looking for