ORA-00917

Hello

I try inserting the values like this

Insert in the process
values (1, 'stock', "select id, e_name, case when enamel is null then ' 'else end ' masked' by address email, stock status, sysdate");

It shows an error like
Error report:
SQL error: ORA-00917: Missing comma
00917 00000 - "missing comma.

How can I rectify this

Hello

It seems that the 3 value is a string that contains single quotes.
To include single quotes inside a string literal, use both of them together:

INSERT INTO process (col1, col2, col3, col4)
VALUES ( 1
       , 'stock'
       , 'select id,e_name,case when email is null Then '' ''else ''masked'' end as email address,status from stock'
       , SYSDATE
       )
;

or use Q-rating:

INSERT INTO process (col1, col2, col3, col4)
VALUES ( 1
       , 'stock'
       , Q'[select id,e_name,case when email is null Then ' 'else 'masked' end as email address,status from stock]'
       , SYSDATE
       )
;

Tags: Database

Similar Questions

  • ORA-00917: lack of comma

    Hello
    I try a subroutine of appellant's rights where I find a missing comma error.

    I have 2 users... hr & system
    I tried to run the code below in USER: hr
    create or replace  type num authid current_user as object
    (
      x number,
      static procedure new_num(n number,schema_name varchar2,table_name varchar2)
    );
    /
    
    create or replace type body num as
      static procedure new_num (n number,schema_name varchar2,table_name varchar2) 
        is
          sql_stmt varchar2(200);
         begin 
             sql_stmt:= 'Insert into  '||schema_name||'.'||table_name||' values(hr.num(:1)';
             execute immediate sql_stmt using n;
          end;
    end;
    /
    grant execute on num to system;
    The code below is run in the system of the USER:
    create table num_tab of hr.num;
    /
    begin 
    hr.num.new_num(10,'hr','num_tab');-- *error* 
    end;
    /
    
    Error report:
    ORA-00917: missing comma
    ORA-06512: at "HR.NUM", line 7
    ORA-06512: at line 2
    00917. 00000 -  "missing comma"
    *Cause:    
    *Action:
    I'm not able to resolve the error.
    Help, please... Is the right way to run these subprogrammes (IE try with 2 users for the appellant's rights program)?

    Thank you

    I agree with Tubby. It is just all sorts of not the way of doing things.

    Your script does not run because you're missing a right bracket at line 6 of your body type.

             sql_stmt:= 'Insert into  '||schema_name||'.'||table_name||' values(hr.num(:1))';
    
  • Range of interval partitioning on yrwk?

    Hello

    Using oracle 11.2.0.3

    We build a large table and many queries will be such, that we want to divide this query on yearweek on yearweek.

    While we could manually add is the partitions possible to have range interval partitioning for this?

    If so, how - have used the interval with columns date range partitioning

    If was months would be nice, but a few years we have 52 and 53 weeks a few years - we have another table of calendar that tells us the number of weeks but not sure if we could use yrwk + interval partitioning

    Thank you

    Your question is not clear enough. The partitioning key can be a single column of the table name and it must be of NUMBER or DATE type. Assuming that your week of the year is a column for the number.

    SQL> --My datbase version.
    SQL> ---------------------
    SQL> SELECT * FROM v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL> DROP TABLE rng_int_part purge;
    
    Table dropped.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE TABLE rng_int_part
      2    (
      3      yrwk NUMBER,
      4      col2 VARCHAR2(1)
      5    )
      6    partition BY range
      7    (
      8      yrwk
      9    )
     10    interval
     11    (
     12      1
     13    )
     14    (
     15      partition p_201402 VALUES less than (201401),
     16      partition p_201403 VALUES less than (201402)
     17*   )
    SQL> /
    
    Table created.
    
    SQL> set line 200
    SQL> ed
    Wrote file afiedt.buf
    
      1  SELECT table_name,
      2    partition_name,
      3    high_value
      4  FROM user_tab_partitions
      5* WHERE table_name='RNG_INT_PART'
    SQL> /
    
    TABLE_NAME                     PARTITION_NAME                 HIGH_VALUE
    ------------------------------ ------------------------------ --------------------------------------------------------------------------------
    RNG_INT_PART                   P_201402                       201401
    RNG_INT_PART                   P_201403                       201402
    
    SQL> INSERT INTO rng_int_part VALUES
      (201401,'A'
      )  2
    SQL> /
      (201401,'A'
                *
    ERROR at line 2:
    ORA-00917: missing comma
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO rng_int_part VALUES
      2    (201401,'A'
      3*   )
    SQL> /
    
    1 row created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO rng_int_part VALUES
      2    (201401,'B'
      3*   )
    SQL> /
    
    1 row created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  SELECT table_name,
      2    partition_name,
      3    high_value
      4  FROM user_tab_partitions
      5* WHERE table_name='RNG_INT_PART'
    SQL> /
    
    TABLE_NAME                     PARTITION_NAME                 HIGH_VALUE
    ------------------------------ ------------------------------ --------------------------------------------------------------------------------
    RNG_INT_PART                   P_201402                       201401
    RNG_INT_PART                   P_201403                       201402
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO rng_int_part VALUES
      2    (201403,'A'
      3*   )
    SQL> /
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  SELECT table_name,
      2    partition_name,
      3    high_value
      4  FROM user_tab_partitions
      5* WHERE table_name='RNG_INT_PART'
    SQL> /
    
    TABLE_NAME                     PARTITION_NAME                 HIGH_VALUE
    ------------------------------ ------------------------------ --------------------------------------------------------------------------------
    RNG_INT_PART                   P_201402                       201401
    RNG_INT_PART                   P_201403                       201402
    RNG_INT_PART                   SYS_P25                        201404
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO rng_int_part VALUES
      2    (201452,'A'
      3    )
      4  /
      5  INSERT INTO rng_int_part VALUES
      6    (201501,'A'
      7*   )
      8  /
    /
    *
    ERROR at line 4:
    ORA-00933: SQL command not properly ended
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO rng_int_part VALUES
      2    (201452,'A'
      3*   )
    SQL> /
    
    1 row created.
    
    SQL>
    SQL> commit;
    
    Commit complete.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO rng_int_part VALUES
      2    (201501,'A'
      3*   )
    SQL> /
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  SELECT table_name,
      2    partition_name,
      3    high_value
      4  FROM user_tab_partitions
      5* WHERE table_name='RNG_INT_PART'
    SQL> /
    
    TABLE_NAME                     PARTITION_NAME                 HIGH_VALUE
    ------------------------------ ------------------------------ --------------------------------------------------------------------------------
    RNG_INT_PART                   P_201402                       201401
    RNG_INT_PART                   P_201403                       201402
    RNG_INT_PART                   SYS_P25                        201404
    RNG_INT_PART                   SYS_P26                        201453
    RNG_INT_PART                   SYS_P27                        201502
    
    SQL> 
    
  • If statements in a trigger

    Hello

    I tried to create a trigger in which when a task is completed, an invoice journal will be generated, use features of employment (date started, finished, cost etc.) to fill the fields of the invoice.

    First of all, it's what I started with:
    CREATE OR REPLACE TRIGGER gen_invoice
    AFTER UPDATE ON jobs FOR EACH ROW
    BEGIN
    IF :new.status = 'Completed' THEN
    DECLARE @Amount NUMBER(8, 2)
    SET @Amount = SELECT SUM(unitCost * qtyUsed + rate + hrs) FROM jobAssign
    WHERE jobNumber = jobs.jobNumber;
    INSERT INTO invoice values (invoice_sequence.nextval, jobs.proposalNo, SYSDATE, SYSDATE + 10,
    jobs.dateGen, jobs.dateReq, jobs.location, Amount, SYSDATE, '10', '100', '10', 'Not Paid');
    END IF;
    END;
    /
    Basically, I wanted to declare a variable called 'Amount' and some fields of work allows to calculate a total. I get the following error if:
     ERROR at line 9: PLS-00103: Encountered the symbol "IF" when expecting one of the following: ; delete exists prior 
    The foregoing, what I really need. However, before I get the above fixed, I thought that I could create another trigger that did not declare all variables or were not in the statements if, just so I can test if the data were inserted properly. So I used:
    CREATE OR REPLACE TRIGGER gen_invoice
    AFTER UPDATE ON jobs FOR EACH ROW
    BEGIN
    INSERT INTO invoice VALUES (invoice_sequence.nextval, jobs.proposalNo, SYSDATE, SYSDATE + 10,
    jobs.dateGen, jobs.dateReq, jobs.location, Amount, SYSDATE, '10', '100', '10', 'Not Paid');
    SELECT proposalNo
    FROM proposals
    WHERE proposalNo = jobs.proposalNo
    AND jobs.status = 'Completed';
    END;
    /
    However, it also did not work. The error come with:
     ERROR at line 2: PL/SQL: ORA-00917: missing comma 
    My main goal is to try to get the first set of instructions to work. So any help is appreciated!

    Thank you.

    P.S. I use the 10.2.0.1.0 oracle version if that helps.

    Strange, it worked for me when I created the trigger, I even received a bill out of it! :-)

    You have: new.jobnumber - he is known because it is the line that caused the trigger to fire.

    Are you sure that you copy this exactly?

    After EXACTLY what you have now.

    Published by: Paul Horth on 3 may 2012 06:10

  • Reg: inserting values using procedures in odi

    Hello

    Hello everyone, I have a requirement like values are inserted into the table of DBMS using the odi procedure very.

    I use this procedure in a package, this package including refresh variables so that it runs several times using County.

    I'm trying to insert values into the table, the table is empty. so when I am trying to run this package I get error like

    This

    ODI-1228: Dailyfileloads task (procedure) insertion fails on the target of ORACLE DSS_ORACLE connection.
    Caused by: java.sql.SQLSyntaxErrorException: ORA-00917: Missing comma

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1079)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3752)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3937)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1535)
    at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:163)
    at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
    at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
    at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:537)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:338)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:263)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:822)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:662)

    I'm not able to solve this please help me.

    Code of procedure like this: insert into dailyload_apmstr (FILENAME) values (DSS. #sample);

    Kind regards
    Sri

    Can you please close the thread marking the answers that help complete or correct

  • Update Java because of the comma mising exception

    Just go through the following statement

    stmt.executeUpdate ("INSERT INTO STOCK_COMMENT" +)
    "VALUES ('+ '.
    ("to_date (to_char (to_date(sysdate-1)," DD - MON - YYYY-') |' "+ dt +"(', ' DD-LUN-AAAA-HH: mi PM') ',' ' "
    cmt + « ') ») ;

    DT and cmt have the following values

    DT:-08:43
    CMT: in the coming days the market is likely to remain in a narrow range of 5030 and 5177, says Pankaj Jain of Satguru capital Zee business. The bias is always positive and the market could open up half a percent at 5098, he adds. Buy OWL with a goal of 5182 and stop loss of 5079 or 5015, advises.

    Can someone tell me why the following exception about lack of ',' is thrown

    java.sql.SQLException: [Oracle] [ODBC] [Ora] ORA-00917: Missing comma
    at sun.jdbc.odbc.JdbcOdbc.createSQLException (unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError (unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect (unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute (unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate (unknown Source)
    at UpdateTable.updateIntoTable (UpdateTable.java:36)
    at CallbackHandler.show_line (CallbackHandler.java:106)
    at CallbackHandler.handleSimpleTag (CallbackHandler.java:76)
    at javax.swing.text.html.parser.DocumentParser.handleEmptyTag (unknown Source)
    at javax.swing.text.html.parser.Parser.startTag (unknown Source)
    at javax.swing.text.html.parser.Parser.parseTag (unknown Source)
    at javax.swing.text.html.parser.Parser.parseContent (unknown Source)
    at javax.swing.text.html.parser.Parser.parse (unknown Source)
    at javax.swing.text.html.parser.DocumentParser.parse (unknown Source)
    in Main.main (Main.java:29)

    Hagrid says:

    stmt.executeUpdate("INSERT INTO STOCK_COMMENT" + "VALUES (" +
    

    Looks like you are missing a space between STOCK_COMMENT and VALUES .

    Good bye
    DPT

  • error in the syntax of the trigger

    Drop trigger hp_backup_check;
    create or replace trigger hp_backup_check
    AFTER INSERT on hp_patient_record
    FOR EACH LINE
    BEGIN
    INSERT INTO hp_backup_record
    values (: old.record_id,: old.patient_name,: old.patient_age,: old.admit_department, sysdate, user of double);
    END;
    /



    I get an error message like


    PL/SQL: SQL statement ignored
    PL/SQL: ORA-00917: Missing comma


    Please please help
    INSERT INTO hp_backup_record
    select :old.record_id, :old.patient_name, :old.patient_age, :old.admit_department, sysdate, user from dual;
    
    OR 
    
    INSERT INTO hp_backup_record
    values(:old.record_id, :old.patient_name, :old.patient_age, :old.admit_department, sysdate, user );
    
  • Need help with insert

    Hello
    When inserting records into the table, I get the below error. I tried a few options, but its not solving my problem, could u pls help me on this.

    Table script:
    -------------
    create table test
    (
    datadate number (12).
    sla_met_time varchar2 (40),
    location varchar2 (20));

    My sql:
    --------
    Insert in the test
    values (&,(&2) 1 & 3);

    commit;
    "exit";

    Values:
    -------
    & 1-> 20101205
    & 2-> 12/06 03.20.31AM
    & 3-> US

    Calling script:
    --------------
    sqlplus-s user/pwd@db @/home/tes/test.sql $usdate, $ustime $usloc

    Error:
    ------
    old 2: values (1, 2 & 3)
    new 2: values (20101205,12/06,03.20.31AM,US)
    values (20101205,12/06,03.20.31AM,US)
    *
    ERROR on line 2:
    ORA-00917: lack of comma


    Also, I'm passing "12/06 03.20.31AM" for "and 2", but in the new value his impression that the "12/06,03.20.31AM".»
    I did not understand how extra comma came after "12/06.

    Please help me on this. Thank you.

    Hello

    You must pass the VARCHAR values in quotes and should not include a comma between the two.

    &1 --> 20101205
    &2 ---> '12/06 03.20.31AM'
    &3 ---> 'US'
    

    See you soon

    VT

  • NDS Insert statement glitch

    DB version XE 10 g

    Hello

    I have little problem with my insert statement.

    In my code, the examples are numerous, but please focus on the part V2 and V3.

    As you can see V2 and V3 will not work

    I get the following errors

    V2
    Error report:
    ORA-00984: column not allowed here
    ORA-06512: at line 28
    00984 00000 - "unauthorized column here.

    V3
    Error report:
    ORA-00917: lack of comma
    ORA-06512: at line 33
    00917 00000 - "missing comma.

    I have no idea why I get these errors...
    DROP TABLE FILMYARNOLD;
    
    CREATE TABLE FILMYARNOLD
    (
        FIL_ID VARCHAR2 (329),
        FIL_NAME VARCHAR2 (592),
        FIL_YEAR VARCHAR2 (294),
        FIL_ACTOR VARCHAR2 (392),
        FIL_TEXTT VARCHAR2 (2596)
    );
    
    
    
    SET SERVEROUTPUT ON
    DECLARE
      TYPE FIL_TABLE IS TABLE OF VARCHAR2 (256);
      vfilmiczki FIL_TABLE := fil_table();
      statement VARCHAR2 (2048);
    BEGIN
    vfilmiczki.EXTEND;
    vfilmiczki(1) := '77804';
    vfilmiczki.EXTEND;
    vfilmiczki(2) := 'Predator';
    vfilmiczki.EXTEND;
    vfilmiczki(3) := '1984';
    vfilmiczki.EXTEND;
    vfilmiczki(4) := 'Arnold';
    vfilmiczki.EXTEND;
    vfilmiczki(5) := 'get to the choppa';
    /*statement := 'INSERT INTO FILMYARNOLD (FIL_ID, FIL_NAME, FIL_YEAR, FIL_ACTOR, FIL_TEXTT) VALUES ( ';
    statement := statement|| '''chlip'',''lol'',''lol'',''chlip''';--
    statement := statement||',''hmm'')';*/
    -------------------------------
    -------V1------------working-----------------
    --statement := 'INSERT INTO FILMYARNOLD (FIL_ID) VALUES ( ';
    --statement := statement||vfilmiczki(1)||' )';
    --EXECUTE IMMEDIATE statement;
    -----------------------------------
    --------V2-------------------- not working -----------------------------------------
    --statement := 'INSERT INTO FILMYARNOLD (FIL_ID, FIL_NAME) VALUES ( ';
    --statement := statement||vfilmiczki(1)||','||vfilmiczki(2)||' )';
    --EXECUTE IMMEDIATE statement;
    --------------------------------------------
    ----V3------------ not working ------------
    statement := 'INSERT INTO FILMYARNOLD (FIL_ID, FIL_NAME, FIL_YEAR, FIL_ACTOR, FIL_TEXTT) VALUES ( ';
    statement := statement||vfilmiczki(1)||','||vfilmiczki(2)||','||vfilmiczki(3)||','||vfilmiczki(4)||','||vfilmiczki(5)||' )';
    EXECUTE IMMEDIATE statement;
    ------------------------------------------------------
    /* statement := 'INSERT INTO FILMYARNOLD VALUES (:jeden, :dwa, :trzy, :cztery, :piec)';
    EXECUTE IMMEDIATE statement
      USING vfilmiczki(1)
      ,     vfilmiczki(2)
      ,     vfilmiczki(3)
      ,     vfilmiczki(4)
      ,     vfilmiczki(5); */
      /*
      statement := 'INSERT INTO FILMYARNOLD VALUES ('; --(:jeden, :dwa, :trzy, :cztery, :piec)';
        FOR i IN 1..vfilmiczki.COUNT
        LOOP
            IF i = vfilmiczki.LAST THEN
                statement := statement||vfilmiczki(i)||' )';
            ELSE
            statement := statement||vfilmiczki(i)||', ';
          END IF;
            --DBMS_OUTPUT.PUT_LINE (vfilmiczki(i));
        END LOOP;
        EXECUTE IMMEDIATE statement;
        */
        --INSERT INTO FILMYARNOLD 
        --VALUES (vfilmiczki(vfilmiczki.FIRST),vfilmiczki(2),vfilmiczki(3),
                --vfilmiczki(4), vfilmiczki(5)); 
        --DBMS_OUTPUT.PUT_LINE ('*****************');
        --DBMS_OUTPUT.PUT_LINE (vfilmiczki((vfilmiczki.LAST)));
    END;
    /
    IM waiting for your responses

    Greetings

    Hello

    change V2 to:

    STATEMENT := 'INSERT INTO FILMYARNOLD (FIL_ID, FIL_NAME) VALUES ( ';
    STATEMENT := STATEMENT||VFILMICZKI(1)||','''||VFILMICZKI(2)||''' )';
    EXECUTE IMMEDIATE statement;
    

    and V3 for:

    ----V3------------ not working ------------
    STATEMENT := 'INSERT INTO FILMYARNOLD (FIL_ID, FIL_NAME, FIL_YEAR, FIL_ACTOR, FIL_TEXTT) VALUES ( ';
    STATEMENT := STATEMENT||VFILMICZKI(1)||','''||VFILMICZKI(2)||''','||VFILMICZKI(3)
                 ||','''||VFILMICZKI(4)||''','''||VFILMICZKI(5)||''' )';
    EXECUTE IMMEDIATE statement;EXECUTE IMMEDIATE statement;
    

    A general remark: INSERT can be used directly in PL/SQL, you don't need to bother with dynamic SQL statements.
    and the PASS-THROUGH is probably more effective than dynamic SQL.

    Try this:

    SET SERVEROUTPUT ON
    DECLARE
      TYPE FIL_TABLE IS TABLE OF VARCHAR2 (256);
      vfilmiczki FIL_TABLE := fil_table();
      statement VARCHAR2 (2048);
    BEGIN
    vfilmiczki.EXTEND;
    vfilmiczki(1) := '77804';
    vfilmiczki.EXTEND;
    vfilmiczki(2) := 'Predator';
    vfilmiczki.EXTEND;
    vfilmiczki(3) := '1984';
    vfilmiczki.EXTEND;
    vfilmiczki(4) := 'Arnold';
    vfilmiczki.EXTEND;
    vfilmiczki(5) := 'get to the choppa';
    
    -------V1------------working-----------------
    INSERT INTO  FILMYARNOLD (FIL_ID) VALUES ( VFILMICZKI(1) );
    
    --------V2-------------------- not working -----------------------------------------
    INSERT INTO FILMYARNOLD (FIL_ID, FIL_NAME) VALUES ( VFILMICZKI(1),VFILMICZKI(2));
    
    ----V3------------ not working ------------
    INSERT INTO FILMYARNOLD (FIL_ID, FIL_NAME, FIL_YEAR, FIL_ACTOR, FIL_TEXTT)
    VALUES ( VFILMICZKI(1), VFILMICZKI(2), VFILMICZKI(3), VFILMICZKI(4), VFILMICZKI(5));
    
    END;
    / 
    
  • Case statement with building xml

    Select
    () XMLType.GetClobVal
    XMLElement ("variable"
    XMLAttributes (vcInternationalDate?" as "type")
    XMLAgg (XMLElement ("item",
    CASE WHEN THE TEMPO IS NOT NULL THEN
    , XMLElement ("utc", TO_CHAR (TIME,' dd/MM/YYYY HH24:MI:SS)) END))
    , XMLElement ("timezone_offSet", ZONE SCHEDULE)
    )
    )
    )
    )
    like 'CREATIONDATE '.
    of twgenericosdb. TEST
    WHERE ID = 1

    The query above without the case statement producing the result to follow:

    < type variable = "vcInternationalDate [:]" >
    < item >
    < utc > 2009-12-20 15:00 < / utc >
    < timezone_offSet > 3600000 < / timezone_offSet >
    < / point >
    < / variable >

    I'm looking for is a way in the case where the time utc is null statement do not tag the utc, utc is NULL the query returns the following result

    < type variable = "vcInternationalDate [:]" >
    < item >
    < utc > < / utc >
    < timezone_offSet > 3600000 < / timezone_offSet >
    < / point >
    < / variable >

    I'm trying to use the instruction box to return utc of the tag in the case of the UTC is NULL, but I get the error ORA-00917: Missing comma.

    Can someone help me?


    Thank you very much.

    Try

    SELECT XMLTYPE.GetClobVal
              (XMLELEMENT
                    ("variable",
                     XMLAttributes('vcInternationalDate[]' AS "type"),
                     XMLAGG(XMLELEMENT("item",
                                       CASE
                                          WHEN TEMPO IS NOT NULL
                                          THEN XMLELEMENT("utc", TO_CHAR(TIME, 'dd/MM/yyyy HH24:MI:SS'))
                                       END),
                            XMLELEMENT("timezone_offSet", TIMEZONE)))) AS "CREATIONDATE"
      FROM twgenericosdb.TEST
     WHERE ID = 1
    

    You can replace the CASE with NVL2

    SELECT XMLTYPE.GetClobVal
              (XMLELEMENT("variable",
                          XMLAttributes('vcInternationalDate[]' AS "type"),
                          XMLAGG(XMLELEMENT("item",
                                            NVL2(TEMPO,
                                                 XMLELEMENT("utc", TO_CHAR(TIME, 'dd/MM/yyyy HH24:MI:SS')),
                                                 NULL),
                                            XMLELEMENT("timezone_offSet", TIMEZONE))))) AS "CREATIONDATE"
      FROM twgenericosdb.TEST
     WHERE ID = 1
    

    URS

    Edited by: metzguar the 06.05.2010 15:04

  • How to store the SQL in the oracle table?

    I tried this way:


    SQL > insert into sql_text values ('select invoice, invoice_dt, DT_INVOICED from PS_BI_HDR where DT_INVOICED = 21)
    (Jan - 2010' and BILL_STATUS ='INV ");
    Insert in sql_text values ('select invoice, invoice_dt, DT_INVOICED from PS_BI_HDR where DT_INVOICED = 21 - JAN-)
    010' and BILL_STATUS ='INV ")
    *
    ERROR on line 1:
    ORA-00917: lack of comma



    Please help to solve, I can't use the concatenation (|)
    coz
     'select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV' '
    It is dynamic.

    user2060331 wrote:
    No sql statement is a dynamic value inserted by a user to execute on the SQl prompt.

    Then use q-literals:

    SQL> ACCEPT stmt PROMPT "Enter statement: "
    Enter statement: select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV'
    SQL> insert into sql_text values('&stmt');
    old   1: insert into sql_text values('&stmt')
    new   1: insert into sql_text values('select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV'')
    insert into sql_text values('select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV'')
                                                                                                          *
    ERROR at line 1:
    ORA-00917: missing comma
    
    SQL> insert into sql_text values(q'[&stmt]');
    old   1: insert into sql_text values(q'[&stmt]')
    new   1: insert into sql_text values(q'[select invoice,invoice_dt,DT_INVOICED from PS_BI_HDR where DT_INVOICED= '21-JAN-2010' and BILL_STATUS='INV']')
    
    1 row created.
    
    SQL> 
    

    SY.

  • Inserting data object types

    Hello
    I have the table according to object type and person in charge:
    create object type dimensions
    area number,
    volume number,
    weight number;
    
    create table objects
    id number,
    color varchar2(10),
    shape varchar2(10),
    dim dimensions,
    date_added date;
    I want to insert values only in id, color, brightness. I added the following to my code,
    insert into object (id, color, dim(area,number,weight)) values(3, 'red', dimensions(12, 34, 5));
    It gives me the following error:
    PL/SQL: ORA-00917: missing comma
    Thank you.
    SQL>  create or replace type dimensions as object(
     area number,
     volume number,
     weight number
    );
    /
    Type created.
    
    SQL>  create table objects (
     id number,
     color varchar2(10),
     shape varchar2(10),
     dim dimensions,
     date_added date
    )
    /
    Table created.
    
    SQL>  insert into objects (id, color, dim) values(3, 'red', dimensions(12, 34, 5))
    /
    1 row created.
    
  • Conversion of HH24:MI:SS to the second question

    Hello everyone,

    I am fairly new (read: about 2 days) for the entire PL/SQL world and I have a small problem with one of my projects. I have googled and looked around forums and tried to apply what I took place, but so far without success.

    The general situation is the following:

    I create a .bat file that allows to retrieve data in a comma-delimited file and 'download' the data in a table of my choice. However, in the file, I am 'loading', one of the columns contains a time value of the HH24:MI:SS type (for example: 0:05:32). The sequence of the column in the file matches that of my table and the .bat file.

    My stand-alone table to test this conversion looks like this:

    Table: Conversion_Test

    Column name data type
    NUMBER OF AUTO_ID (12)
    NUMBER OF TIMES (12)
    WORK VARCHAR2 (32 bytes)
    DATE OF UPLOAD_DATE

    AUTO_ID and UPLOAD_DATE columns are filled by the triggers that have been tried, tested and found to be working very well. My test file contains 1 row data raw (no header or any other information is present).

    I managed to convert the HH24:MI:SS in seconds through SQL * more interface with the following query:

    ----------------------------------------------------------------------------------------------------------------------------------------
    SELECT
    SYSDATE, to_number (substr (' 00:05:32 ', 1, 2) * 3600 + substr ("00:05:32 ', 4, 2") * 60 + substr (' 00:05:32 ', 7, 2))
    of the double

    Which returns the correct result:

    SYSDATE
    --------
    TO_NUMBER (SUBSTR (' 00:05:32 ', 1, 2) * 3600 + SUBSTR (' 00:05:32 ', 4, 2) * 60 + SUBSTR ("00:05:32)
    --------------------------------------------------------------------------------
    23/10/08
    332

    Relevant potential content off (not entirely) .bat file:

    DOWNLOAD THE DATA
    INFILE 'dat\%date%.dat '.
    Add
    IN THE Conversion_Test TABLE
    FIELDS TERMINATED BY '; '.
    (
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *.
    Working
    )

    * XXXXXXXX = location of relevant statement.

    I tried to reproduce the results of my query sysdate with the following statements:

    1 time "to_number (substr ('Time', 1, 2)) * 3600"" +"to_number(substr ('Time', 4, 2)) * 60 "" " + " to_number(substr ('Time', 7, 2))"",

    This generates the following error message:

    SQL * Loader-350: Syntaxiserror in the 7th.
    ', 'from') ' expected, '+' found.
    Time "to_number (substr ('time', 1, 2)) * 3600" + "to_number (substr ("Time"^)).


    2 time "to_number (substr ('Time', 1, 2)) * 3600 + to_number(substr ('Time', 4, 2)) * 60 + to_number(substr ('Time', 7, 2))" "."

    3 time "to_number (substr ('Time', 1, 2)) * 3600 + (substr ('Time', 4, 2)) * 60 + (substr ('Time', 7, 2))" "."

    These generate the following error message:

    Sheet 1: denied-error in the table CONVERSION_TEST, TIME column.
    ORA-01722: invalid number

    4 time "to_number (substr ('time', 1, 2)) * 3600 + (substr ('Time', 4, 2)) * 60 + (substr('Time',7,2)) double«,»»

    This generates the following error message:

    Sheet 1: denied-error in the table CONVERSION_TEST, TIME column.
    ORA-00917: lack of comma

    Question: I want to do is turn this HH24:MI:SS 'format' in seconds and then put them in a column of my table numbers by running the .bat file.

    I hope I've provided enough information to give you a good overview of the problem and possible solutions.

    With respect,

    Luhaine

    Published by: user10465140 on 23-Oct-2008 07:28

    Published by: user10465140 on 23-Oct-2008 07:30

    Published by: user10465140 on 23-Oct-2008 07:30

    Published by: user10465140 on 23-Oct-2008 07:33 - Clearafication and clean.

    .. .or let Oracle do the math:

    time "to_number (to_char (to_date (: time, 'HH24:MI:SS'), 'SSSSS')).

  • How to insert data with ' ' in the table

    I have the following requirement

    I gave you some example of table to understand the requirement
    SQL> create table ttt(a varchar2(55));
    
    Table created.
    
    SQL> insert into ttt values('insert into aa values('abc')')
    insert into ttt values('insert into aa values('abc')')
                                                   *
    ERROR at line 1:
    ORA-00917: missing comma
    Although insert the foregoing statement looking for somewhat different, but according to my requirement, I need to do...

    Please help me in this...

    Thank you
    Saliha
    uhhhh....
    
    cant you just substitute your name instead of |
    one and the same thing,
    
    SQL> insert into ttt values('hai ''jyothsna'' how are you');
    
    1 row inserted
    
    SQL> commit;
    
    Commit complete
    
    A
    -------------------------------------------------------
    hai '|' jyothsna how are you
    hai 'jyothsna' how are you
    
  • T - SQL-&gt; conversion of PL/SQL: Insert... select problem

    Hello!

    If I have an insert in... Select T - SQL statement without a clause "from":

    Bq. insert into sometable (foo, bar)-select 5, case when @bar = 5, then 4 3 other purpose
    its translation is:

    Bq. INSERT INTO sometable------(foo, bar)-VALUES (CASE 5,------WHERE 5 = 5 THEN 4-3 OTHER------neck END);
    and I got: ORA-00917: "missing comma" for this. I don't know if this is a bug in the code of migration, or is there something so that I can use 'CASE' in an insert into... statement values somehow?

    Zoli

    You must remove the column name. I've just simplified your test case to check and it works:

    CREATE TABLE test(
      id NUMBER
    );
    
    INSERT
      INTO test(id)
      VALUES(CASE WHEN 5=5 THEN 4 ELSE 3 END)
    ;
    
    SELECT *
      FROM test
    ;
    

    C.

Maybe you are looking for

  • change the music from iphone

    I open iTunes and connect my iPhone to my computer. Click on my iPhone in iTunes, click on music. I see the music on my iPhone. Click on a song, press DELETE. Nothing. Right-click on the song, nothing to delete. Search for menus and there is nothing

  • iTunes not download apps on iPad, stuck on "install".

    I downloaded itunes on pc. He downloaded apps on my ipad running ios5.1.1 1. but it doesent download apps on my ipad 4 current running iOS 9.3.0, amd when I try to download, the app is stuck on "install". the synchronization process also indicates th

  • Finder raises even after forcing them to leave

    On a MacBook Pro retina in early 2013, Mavericks 10.9.5, every time I try to restart the finder, it seems to stop smoking (icons all disappear without bar menus most in finder, app works is not in the activity monitor does not show in menu force quit

  • My HARD 1670 CD drive broke down

    Hi, my internal hard drive (6.0 GB S.M.A.R.T.) broke down, I can't use Fdisk much anymore, it's over for me. Does anyone know what drive is inside my laptop? Anyone know if I can put more large hard drive (20 GB) in my notebook and I can run WinXP to

  • HP MINI 110: Password check failed

    Hi, my Hp mini 110 watch computer: enter the current password. Error fatal system shut down CNU9381BJN. Help, please! :'( I stopped using it because my charger broke and when I bought my new for my laptop, it just continues to ask me what is the pass