Using Check in alter statement

Hi
I am using the statement like this:
alter table dept
modify (deptno check deptno in (10,20,30,40,50));
ERROR at line 2:
ORA-02253: constraint specification not allowed here
Any suggestions?
Thanks

SQL> alter table dept modify (deptno check (deptno in (10,20,30,40,50))) ;
Table altered.
SQL>if you wanted a name for the constraint, you could do:
SQL> alter table dept modify (deptno constraint deptno_ck check (deptno in (10,20,30,40,50))) ;
Table altered.
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
SQL>Added database version. sometimes, that is important.
Message was edited by:
Kamal Kishore

Similar Messages

  • While attempting to check out, ERROR states "Account registered for different country.  Please sign out and sign in using an existing account for this country."

    While attempting to check out, ERROR states "Account registered for different country.  Please sign out and sign in using an existing account for this country."  I started my account in India.  Then changed it to the US when I moved here, then tried to change it back to india when this issue arose, however, the error still occurs.  How can I fix this??

    I think a new account may be the easiest way if you don't have an existing subscription or cloud files for which to keep continuity.

  • How to use the alter statement in Execute

    Hi All,
    Need your help to solve this issue.
    i want the call the alter statement in procedure to load data to the external table.
    As per our requirement location will be given as a input parameter.
    Created procedure as shown below
    CREATE OR REPLACE PROCEDURE apps.rda_cm_postaova_stmt_main (
    p_process_name IN VARCHAR2,
    p_file_name IN VARCHAR2,
    p_submit_option IN VARCHAR2
    AS
    BEGIN
    EXECUTE IMMEDIATE 'ALTER TABLE RDA_POSTOVA_BANK_STMT location' || (p_file_name);
    END;
    it compiled but while executing it end up in below error:
    ORA-01735: invalid ALTER TABLE option
    ORA-06512: at "APPS.RDA_CM_POSTAOVA_STMT_MAIN", line 8
    ORA-06512: at line 2
    Please help to solve this issue.
    Thanks
    Rajesh

    create or replace procedure reset_et_location
    ( p_table    in varchar2
    , p_filename in varchar2)
    is
    begin
      execute immediate 'alter table '||p_table||' location ('''||p_filename||''')';
    end reset_et_location;

  • PreparedStatement puts ticks around strings when doing ALTER statement

    Hi,
    I am trying to add a column to a table with a prepared statement:
    private static final String ALTER_TABLE = "ALTER TABLE scene_tags ADD ? BOOL DEFAULT FALSE";
    addNewTagCol = conn.prepareStatement(ALTER_TABLE);
    addNewTagCol.setString(1, newTagName.getText());
    addNewTagCol.executeUpdate();
    When I execute this in java I get a syntax error from mySQL:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''dd' BOOL DEFAULT FALSE' at line 1
    If I do:
    System.out.println(addNewTagCol.toString());
    I get:
    ALTER TABLE scene_tags ADD 'dd' BOOL DEFAULT FALSE
    The probem is the 'dd' which should be just dd.
    If I copy this into the command line it doesn't like the 'dd'.
    How do I stop the ticks ticking?
    Thanks,
    John

    Personally, I don't think that CREATE and ALTER statements should be executed in Java.
    The schema is usually in place when a Java app starts. The application then performs CRUD operations on a well-defined, static schema. Changing the schema means changing the application, something that you shouldn't be doing on the fly.
    If you think you have to alter a table in a Java app, I'm betting that you have a bad design that needs rethinking.
    Unless you're trying to write an admin tool from scratch, of course. In that case I'd refer you to an admin tool like SQL Squirrel.
    %

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

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

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

  • How to check to numbers at a time using check keyword

    Hi All ,
    I want to use check statement in my report logic where i want to pass only 2 values. at a time..
    ex:
    start-of-selection.
    get pernr.
    Check p0001-persg = '5300' or check p0001-persg = '5600'.->Getting error here
    end-of-selection.
    Could please any one guide better..
    Regards
    sas

    Try this.
    TABLES: PERNR.
    INFOTYPES: 0001.
    start-of-selection.
    get pernr.
    end-of-selection.
        PROVIDE * FROM P0001 BETWEEN PN-BEGDA AND PN-ENDDA
        where p0001-persg = '5300' or p0001-persg = '5600' .
        WRITE:  / P0001-PERNR,
                  P0001-SUBTY,
                  P0001-BEGDA,
                  P0001-ENDDA,
                  p0001-persg.
        ENDPROVIDE.

  • BW Transformation formula using If in list statement

    Hi there, I am trying to create some logic with a transformation formula and nested if statements.  I believe that it does not like the IN context.  Can someone tell me how to properly state in list as part of below formula?
    IF( SUBSTRING( PRDHA, 9, 4 ) IN ( '5004', '5089', '5097', '5119', '5013', '5094', '5099', '5114', '5116', '5125', '5136', '5164', '5171', '5183' ), 'S','B')

    Thanks for the responses.
    I ended up utilizing an ABAP routine:
    IF lv_brand = '5004' OR
           lv_brand = '5089' OR
           lv_brand = '5097' OR
           lv_brand = '5119'
    RESULT = 'S'.
    ELSEIF ( lv_brand = '5001' OR
                 lv_brand = '5010' OR
                 lv_brand = '5052') OR
                  ( lv_matnr = '6919' OR
                 lv_matnr = '6939').
          RESULT = 'C'.
    If you want to check if field is empty use IS INITIAL as statement
        ELSEIF lv_brand IS INITIAL.
          RESULT = 'N'.
        ELSE.
          RESULT = 'O'.
        ENDIF.

  • Procedure not checking each sql statement.

    Hi All,
    I have created 2 tables names are A1 and B1. A1 table has some fields. Fields are no,sal,comm.,load_date. In A1 table NO (column) is the primary key.
    Second table is B1. this table has id,phone_no and load_date. In this table constraint
    ID column is the Not null.
    After that I have created 2 procedures one for A1 and one for B1. with in those procedures I used SQL insert statements.
    In procedures I used some valid sql statements and some invalid statements ( invalid statements means that I have specified constraint that’s why I specified duplicated and null values). While executing the procedures procedure shows error because of invalid statement and in that procedures I did not specify any Exceptions.
    If I specify Exceptions in procedures executing successfully some records are not loading procedure is comeing out. How do we mention server needs to be check and every insert sql startement.
    EX:
    If I give 6 records from 1 to 3 valid statements. I mentioned 4 th record copy of previos record( duplicated). 5 th record and 6 th valid records.
    Procedure executing successfully. Procedure loaded 1 to 4 records after that not loaded 5,6 and 7 records. How do we specify for record inserts 7. actually 7 th record is valid statement we should be insert this record. Please tell me how do we handle sql statements each and every one successfully or not.
    create or replace procedure a_proc as
    --declare
    begin
    insert into a1 values (100,2000,300,sysdate);
    insert into a1 values(200,1000,400,sysdate);
    insert into a1 values(300,3000,500,sysdate);
    insert into a1 values(400,6000,600,sysdate);
    insert into a1 values(400,900,700,sysdate);
    insert into a1 values(400,10000,1200,sysdate);
    insert into a1 values(900,11000,1300,sysdate);
    commit;
    EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERROR - '||sqlerrm);
    end a_proc;
    In B1 table colums are ID,PHONE_NO and Load_date. ID is not null column.
    For B1 population I have created one procedure
    create or replace procedure b_proc as
    --declare
    begin
    insert into b1 values(1,123456,sysdate); -- 1 record
    insert into b1 (phone_no,load_date) values (7896538,sysdate); --2 record
    insert into b1 (phone_no) values(6763723458); ----3 record
    insert into b1 (phone_no) values(453465778); --4 record
    insert into b1 values(400,72894894,sysdate); --5 record
    insert into b1 values(500,72894894,sysdate); --6 record
    commit;
    EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERROR - '||sqlerrm);
    end b_proc;
    if I execute above procedure procedure executing successfully but procedure inserting only first record not inserting 5th and 6th record. How do we exception for 5th and 6th records also.
    Thanks and Regards,
    Venkat

    {color:#808080}{color:#333300}Hi,
    Please find answer to your question below:{color}
    Venkat: Procedure executing successfully. Procedure loaded 1 to 4 records after that not loaded 5,6 and 7 records. How do we specify for record inserts 7. actually 7 th record is valid statement we should be insert this record. Please tell me how do we handle sql statements each and every one successfully or not.
    {color}
    {color:#0000ff}Guna: The procedure hits an exception after 4th record, and does not process anymore as it exits out of the procedure, I believe the data is not committed as well. You need handle exceptions if the processing has to continue. Same is the belwo case as well
    {color}{color:#333300}Regards,
    Guna{color}

  • How to use INSERT INTO ALL statement in jdbc prepared statement with beans

    Kindly give me some example that how we can use "INSERT INTO ALL STATEMENT" in jdbc prepared statement inside a jsf bean?
    Actually i want to take employee id's of present employees using single jsf page and using one textbox for each employee id.
    How can i use INSERT INTO ALL statement to achieve this?
    Following is my code snippet.
    AttendanceBean.java:
    public class AttendanceBean {
    private int atteid;
    private String attdname;
    private int attday;
    private int attmonth;
    private int attyear;
    public static Connection getAttConnection() throws Exception {
    String driver = "oracle.jdbc.driver.OracleDriver";
    String url = "jdbc:oracle:thin:@localhost:1521:globldb3";
    String username = "scott";
    String password = "tiger";
    Class.forName(driver);
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;
    public String addAttendance(){
    Connection conn = null;
    PreparedStatement pstmt = null;
    boolean committed = false;
    try {
    conn = getAttConnection();
    conn.setAutoCommit(false);
    String query = "INSERT ALL INTO attendance VALUES (?,?,?,?,?)";
    pstmt = conn.prepareStatement(query);
    pstmt.setInt(1,this.atteid);
    pstmt.setString(2,this.attdname);
    pstmt.setInt(3,this.attday);
    pstmt.setInt(4,this.attmonth);
    pstmt.setInt(5,this.attyear);
    pstmt.executeUpdate();
    conn.commit();
    conn.setAutoCommit(true);
    committed = true;
    return "home.xhtml";
    } catch (Exception e) {
    e.printStackTrace();
    return "CRM.xhtml";
    } finally {
    try{
    if (!committed) conn.rollback();
    if (pstmt != null) pstmt.close();
    if (conn != null) conn.close();
    }catch(Exception e){
    e.printStackTrace();
    }

    Check this program for some info on Push buttons:
    1-DEMO_DYNPRO_PUSH_BUTTON
    2-DEMO_DYNPRO_MODULE
    3-DEMO_DYNPRO_ON_CONDITION
    Suppose Your screen is 101
    Then in that screen create one push button and assign it a function code.
    Now in the PAI of the 101 screen
    Create Module for user command
    Inside that module checc the sy-ucomm if sy-ucomm eq <Function code of your push button>
    Insert the values in database.
    *& Module USER_COMMAND_0101 INPUT
    process after input for screen 0101 *
    MODULE USER_COMMAND_0101 INPUT.
    CASE OK_CODE.
    WHEN 'SAVE'.
    *Insert the values here
    WHEN 'DISP'.
    ENDCASE.
    CLEAR OK_CODE.
    ENDMODULE. " USER_COMMAND_0101 INPUT
    Regards
    Neha
    Edited by: Neha Shukla on Dec 3, 2008 1:02 AM
    Edited by: Neha Shukla on Dec 3, 2008 1:02 AM
    Edited by: Neha Shukla on Dec 3, 2008 1:06 AM

  • How to achieve Check point functionality in SSIS with out using check point.

    I got question from
    interview!!! How
    to achieve Check
    point functionality in SSIS with out using check point. If package
    fails it has to be re-run from the point that it failed instead
    of rerunning the entire package.without
    using check point.
    Please
    any one can explain step by step...

    Sorry you have failed your interview question. Good thing you remembered it, thought about it, and ask a question about it. The solution is actually very straightforward.
    Create a table to store the state of your progress. Before each step read the table to find out where left off, then skip each completed step. After each step write to the table which step you have completed. A step can be anything, a task, a component,
    a row, an import file, an export file. You don't have to use a table, it could also be a file, just something you can read and write, and does not disappear when your package stops.
    If you find this difficult to comprehend, think of a checklist of things you do everyday and work from there.

  • SQL Statement within alter statement

    Has anybody used a sql statement inside of an alter statement?
    example:
    alter index index_name rebuild;
    trying to get the index_name by doing the following:
    alter index '|| select index_name from user_ind_columns ||' rebuild;
    Thank you.

    Are you trying to generate a script ?
    I think it would be more like :-
    select 'alter index '||owner||'.'||index_name||' rebuild;' from dba_indexes where owner = 'MYUSER';

  • Check the Row state in Application Module.

    Hi All,
    I have an EOVO in my page. Is there any way to check the row state in Application module??
    My requirement is if any row is created for the EOVO , just delete it.
    Please suggest suitable methods to fulfill this requirement...
    Regards,
    Tarun

    Yes, you can check the status of the rows of a VO in Application Module(AM)
    In AM, get the instance of the VO and loop through it's rows and check the status of the rows as
    In row you have a method called getNewRowState(). It will return values like Row.STATUS_INITIALIZDED etc.
    Check the javadoc of oracle.jbo.Row for possible values and explanations about the status.
    So ideally you have to write a condition as follows. This is a sample code..just use as a guide.
    if (row.getNewRowState() = oracle.jbo.Row.STATUS_INITIALIZED){
    row.remove();
    Regards,
    Peddi.

  • Use of LINE OF statement

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

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

  • Alter Statement in Select

    Can we write an alter statement in Select Query?

    Dynamic sql
    SQL> create table t_al (al number(10));
    Table created.
    SQL>
    DECLARE
       v_al   VARCHAR2 (200);
    BEGIN
        select 'alter table t_al modify al varchar2(20)' into v_al from dual;
    execute immediate v_al;
    end;
    PL/SQL procedure successfully completed.
    SQL> desc t_al;
      AL  VARCHAR2(20 CHAR)

  • How to use check box & dropdownlist in smart forms

    can anybdy explain(any examples) how i can use check box or drop down list in smart forms.is ther any provision like that

    Hi Ranjith,
    To use Check box in smartform do the following:
    Change the editor to 'PC Editor' and take the menu.
    in text editor of TEXT ELEMENTS..
    Insert -> Characters -> SAP Symbols
    in print preview u can't see these changes..
    for more details check this link..
    How to create checkbox in smartforms??
    Ashven

Maybe you are looking for

  • Qosmio X505 Q850 will not boot.

    As the title implies I have a Qosmio that will not boot. When I turn it on the power button and power light go on for a second and then off for ten. it repeats this in perpetuity. I've swapped the ram i had in it, put the original ram back in and i s

  • Nidll.tlc does not generate .dll file

    Hello all, I have been following the tutorial at http://zone.ni.com/reference/en-XX/help/371504F-01/lvsithowto/sit_h_convert_model_to_dll/ After I click "Build", MatLab says: Successful completion of Real-Time Workshop build procedure for model: sine

  • ORA-01031 insuffiecient privilidges

    i am unable to login to oracle 10g as 'sys' as sysdba it is throwing an error like ORA-01031 insufficient privilidges for sys. but when i connect to database with username=system and password = oracle i am able to connect to database. i have installe

  • Very slow indexing!!!

    Hi, First, we had loaded some 10 GB of documents into Oracle. Next we created an full text search index on this data. After this we loaded 8 GB of more data and then used the ALTER INDEX MY_INDEX REBUILD PARAMETERS('resume') command. I understand tha

  • Simulation of shipment cost

    Hello Experts, I am looking for the program or BAPI that will help me to simulate the shipment cost for the supplies made by tank truck to the customer or to my other plants. I donot want to save the shipment cost document, but only want to calculate