Error:insert into testtable numbercolumn values('9,000.00')

In testtable, ID(number(12), amount(number(12))
Now I want to insert the following record. I got error,a invalid number .
insert into testtable(id,amount) values('111','9,000.00');
I think data type is different. amount is number type but '9,000.00' is varchar2.
How can i insert '9,000.00' to number data type?
I do insert to_number('9,000.00'). It doesn't work. Would you help me for this problem.

Since the datatype is number, if your data is not coming from any convertable source as '9,000.00' (i.e a big auto-generated file from another system that needs data conversation), why bother when oracle will still store it in the table as 9000.
SQL> create table testtable (ID number(12), amount number(12));
Table created.
SQL> insert into testtable(id,amount) values(111,to_number('9,000.00','9,999.00'));
1 row created.
SQL> select * from testtable;
ID AMOUNT
111 9000
SQL> insert into testtable(id,amount) values(111,9000);
1 row created.
SQL> select * from testtable;
ID AMOUNT
111 9000
111 9000
SQL>

Similar Messages

  • HELP!!: Error inserting into table in exception block

    I have some pl/sql code. In the exception section I have several lines of code similar to:
    WHEN NO_DATA_FOUND THEN
    INSERT INTO SCHEMA.ERR_TABLE (err_num, line)
    values ('101', V_LINE);
    When I try to compile the code it gives me an error:
    (1):PLS-00201: identifier 'TEMP_ERRS' must be declared
    (2):PL/SQL: SQL Statement ignored
    (3):PLS-00201: identifier 'TEMP_ERRS' must be declared
    (4):PL/SQL: SQL Statement ignored
    TEMP_ERRS is just a table that exists in a schema?
    I tried inserting a record into this table in plain sql code and it worked.
    What am I missing??
    TIA-
    null

    I was able to insert a test record into TEMP_ERRS using plain sql, and it worked so I believe I should have the correct previlage.
    The only difference is that the PL/SQL code is part of a trigger, what specific previlage would I need?
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Kaleem Mohammed Abdul ([email protected]):
    If the table/Synonym is not in the current schema, check for the privileges<HR></BLOCKQUOTE>
    null

  • MS SQL Server 2014: Error inserting into Temp table with index and identity field

    In this thread, I mentioned a problem with SQL Server 2014:
    SQL Server 2014: Bug with IDENTITY INSERT ON
    The question was answered, it is a bug. To keep you informed on this issue, I open this discussion.
    Problem:
    The code below works perfectly fine on MS SQL Server 2008 R2 and MS SQL Server 2012, but gives an error every second time the proc is executed on MS SQL Server 2014. If I do not define any index on the temp table, the problem disappears. Defining the index
    after the insert, does not help.
    SET NOCOUNT ON
    GO
    IF EXISTS (SELECT 1 FROM sys.procedures WHERE name = 'usp_Test') DROP PROC dbo.usp_Test;
    GO
    CREATE PROC dbo.usp_Test AS
    BEGIN
    SET NOCOUNT ON
    CREATE TABLE #Source(ID integer NOT NULL);
    INSERT INTO #Source VALUES (1), (2), (3);
    CREATE TABLE #Dest (ID integer IDENTITY(1,1) NOT NULL);
    CREATE INDEX #IDX_Dest ON #Dest (ID);
    PRINT 'Check if the insert might cause an identity crisis';
    SELECT 'Source' AS SourceTable, * FROM #Source;
    SELECT 'Destination' AS DestTable, * FROM #Dest;
    SET IDENTITY_INSERT #Dest ON;
    PRINT 'Do the insert';
    INSERT INTO #Dest (ID) SELECT ID FROM #Source;
    PRINT 'Insert ready';
    SET IDENTITY_INSERT #Dest OFF;
    SELECT * FROM #Dest;
    DROP TABLE #Source;
    DROP TABLE #Dest;
    END;
    GO
    PRINT 'First execution of the proc, everything OK';
    EXEC dbo.usp_Test;
    PRINT '';
    PRINT 'Second execution of the proc, the insert fails.';
    PRINT 'Removing the index #IDX_Dest causes the error to disappear.';
    EXEC dbo.usp_Test;
    GO
    DROP PROC dbo.usp_Test;
    GO

    There is some progress. Communication from a former Microsoft employee tells us this:
    Shivendra Vishal
    Engineer at Microsoft
    I am no longer with MS, and I do not have code access, however from the public symbols, I could make out following:
    sqlmin!SetidentI2I4+0x1f3:
    000007fe`f4d865d3 488b10 mov rdx,qword ptr [rax] ds:00000000`00000000=????????????????
    ExceptionAddress: 000007fef4d865d3 (sqlmin!SetidentI2I4+0x00000000000001f3)
    ExceptionCode: c0000005 (Access violation)
    ExceptionFlags: 00000000
    NumberParameters: 2
    Parameter[0]: 0000000000000000
    Parameter[1]: 0000000000000000
    Attempt to read from address 0000000000000000
    This is a read AV and from registers it is clear that we were trying to move the value of location pointed by qword of register rax which is not valid:
    rax=0000000000000000 rbx=0000000000000038 rcx=0000000000001030
    rdx=0000000000000006 rsi=00000001f55def98 rdi=00000000106fd070
    rip=000007fef4d865d3 rsp=00000000106fcf40 rbp=00000000106fcfe9
    r8=0000000000000000 r9=00000001f55def60 r10=00000001f55defa0
    r11=00000000106fcd20 r12=0000000000000000 r13=0000000000000002
    r14=00000001f49c3860 r15=00000001f58c0040
    iopl=0 nv up ei pl nz na po nc
    cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010206
    The stack is:
    # Child-SP RetAddr Call Site
    00 00000000`106fcf40 000007fe`f30c1437 sqlmin!SetidentI2I4+0x1f3
    01 00000000`106fd050 000007fe`f474e7ce sqlTsEs!CEsExec::GeneralEval4+0xe7
    02 00000000`106fd120 000007fe`f470e6ef sqlmin!CQScanUpdateNew::GetRow+0x43d
    03 00000000`106fd1d0 000007fe`f08ff517 sqlmin!CQueryScan::GetRow+0x81
    04 00000000`106fd200 000007fe`f091cebe sqllang!CXStmtQuery::ErsqExecuteQuery+0x36d
    05 00000000`106fd390 000007fe`f091ccb9 sqllang!CXStmtDML::XretDMLExecute+0x2ee
    06 00000000`106fd480 000007fe`f08fa058 sqllang!CXStmtDML::XretExecute+0xad
    07 00000000`106fd4b0 000007fe`f08fb66b sqllang!CMsqlExecContext::ExecuteStmts<1,1>+0x427
    08 00000000`106fd5f0 000007fe`f08fac2e sqllang!CMsqlExecContext::FExecute+0xa33
    09 00000000`106fd7e0 000007fe`f152cfaa sqllang!CSQLSource::Execute+0x86c
    0a 00000000`106fd9b0 000007fe`f152c9e8 sqllang!CStmtExecProc::XretLocalExec+0x25a
    0b 00000000`106fda30 000007fe`f152a1d8 sqllang!CStmtExecProc::XretExecExecute+0x4e8
    0c 00000000`106fe1e0 000007fe`f08fa058 sqllang!CXStmtExecProc::XretExecute+0x38
    0d 00000000`106fe220 000007fe`f08fb66b sqllang!CMsqlExecContext::ExecuteStmts<1,1>+0x427
    0e 00000000`106fe360 000007fe`f08fac2e sqllang!CMsqlExecContext::FExecute+0xa33
    0f 00000000`106fe550 000007fe`f0902267 sqllang!CSQLSource::Execute+0x86c
    10 00000000`106fe720 000007fe`f0909087 sqllang!process_request+0xa57
    11 00000000`106feee0 000007fe`f2bf49d0 sqllang!process_commands+0x4a3
    12 00000000`106ff200 000007fe`f2bf47b4 sqldk!SOS_Task::Param::Execute+0x21e
    13 00000000`106ff800 000007fe`f2bf45b6 sqldk!SOS_Scheduler::RunTask+0xa8
    14 00000000`106ff870 000007fe`f2c136ff sqldk!SOS_Scheduler::ProcessTasks+0x279
    15 00000000`106ff8f0 000007fe`f2c138f0 sqldk!SchedulerManager::WorkerEntryPoint+0x24c
    16 00000000`106ff990 000007fe`f2c13246 sqldk!SystemThread::RunWorker+0x8f
    17 00000000`106ff9c0 000007fe`f2c13558 sqldk!SystemThreadDispatcher::ProcessWorker+0x3ab
    18 00000000`106ffa70 00000000`775d59ed sqldk!SchedulerManager::ThreadEntryPoint+0x226
    19 00000000`106ffb10 00000000`7780c541 kernel32!BaseThreadInitThunk+0xd
    1a 00000000`106ffb40 00000000`00000000 ntdll!RtlUserThreadStart+0x21
    Unassembling the function:
    000007fe`f4d8658e 4c8b10 mov r10,qword ptr [rax]
    000007fe`f4d86591 4533e4 xor r12d,r12d
    000007fe`f4d86594 410fb7d5 movzx edx,r13w
    000007fe`f4d86598 4533c9 xor r9d,r9d
    000007fe`f4d8659b 4533c0 xor r8d,r8d
    000007fe`f4d8659e 488bc8 mov rcx,rax
    000007fe`f4d865a1 4489642420 mov dword ptr [rsp+20h],r12d
    000007fe`f4d865a6 41ff5230 call qword ptr [r10+30h]
    000007fe`f4d865aa 8b5597 mov edx,dword ptr [rbp-69h]
    000007fe`f4d865ad 4c8b10 mov r10,qword ptr [rax]
    000007fe`f4d865b0 4489642438 mov dword ptr [rsp+38h],r12d
    000007fe`f4d865b5 4489642430 mov dword ptr [rsp+30h],r12d
    000007fe`f4d865ba 458d442401 lea r8d,[r12+1]
    000007fe`f4d865bf 4533c9 xor r9d,r9d
    000007fe`f4d865c2 488bc8 mov rcx,rax
    000007fe`f4d865c5 c644242801 mov byte ptr [rsp+28h],1
    000007fe`f4d865ca 4488642420 mov byte ptr [rsp+20h],r12b
    000007fe`f4d865cf 41ff5250 call qword ptr [r10+50h]
    000007fe`f4d865d3 488b10 mov rdx,qword ptr [rax] <=================== AV happened over here
    000007fe`f4d865d6 488bc8 mov rcx,rax
    000007fe`f4d865d9 4c8bf0 mov r14,rax
    000007fe`f4d865dc ff5268 call qword ptr [rdx+68h]
    000007fe`f4d865df 488d55e7 lea rdx,[rbp-19h]
    000007fe`f4d865e3 4c8b00 mov r8,qword ptr [rax]
    000007fe`f4d865e6 488bc8 mov rcx,rax
    000007fe`f4d865e9 41ff5010 call qword ptr [r8+10h]
    000007fe`f4d865ed f6450a04 test byte ptr [rbp+0Ah],4
    I remember few issues with scan2ident function, I am not sure if they have fixed it however it appears that this is intoduced to SQL 2014 and we need help from MS to get this resolved as it needs code analysis.
    It is not getting simulated for other versions of SQL apart from SQL 2014.
    Also to add, interestingly, the value of rax is not visibly changed and it was successfully passed on to rcx, which has a valid value, so something should have changed the value of rax inside call to function using call qword ptr [r10+50h], and looking at this
    it appears that it might be a list of functions and we are going at particular offset [50h]. So, bottom line is that the call to function qword ptr [r10+50h], should be changing something in rax, and debugging/analyzing this code might give us some more idea.

  • Error inserting into database

    need help,am tryin to insert data into my database which contains date,
    names,phone,address and deposit and it's giving this error message:
    java.lang.ClassCastException:java.util.Date cannot be cast to java.sql.Date.
    somebody help me please.thanks in advance.
    code:
    '\n'
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    import java.text.*;
    public class NewCustomerRecord extends JFrame{
         private JTextField firstnameF,othernameF,phoneF,addressF,depositF,currentF,dateF;
         private JButton registerbutton;
         private Connection con;
         private Statement st;
         private ResultSet set;
         private PreparedStatement stat;
         public NewCustomerRecord(){
              //super(f,"",true);
              JPanel panel = new JPanel();
              panel.setLayout(null);
              JLabel firstL = new JLabel("First Name:");
              firstL.setBounds(5,15,80,20);
              panel.add(firstL);
              firstnameF = new JTextField();
              firstnameF.setBounds(70,15,100,20);
              panel.add(firstnameF);
              JLabel otherL = new JLabel("Other Names:");
              otherL.setBounds(175,15,80,20);
              panel.add(otherL);
              othernameF = new JTextField();
              othernameF.setBounds(255,15,100,20);
              panel.add(othernameF);
              JLabel phoneL = new JLabel("Phone No.:");
              phoneL.setBounds(5,40,80,20);
              panel.add(phoneL);
              phoneF = new JTextField();
              phoneF.setBounds(70,40,100,20);
              panel.add(phoneF);
              JLabel addressL = new JLabel("Address:");
              addressL.setBounds(185,40,80,20);
              panel.add(addressL);
              addressF = new JTextField();
              addressF.setBounds(255,40,100,20);
              panel.add(addressF);
              JLabel depositL = new JLabel("Deposit:");
              depositL.setBounds(5,65,60,20);
              panel.add(depositL);
              depositF = new JTextField();
              depositF.setBounds(70,65,100,20);
              panel.add(depositF);
              /*JLabel currentL = new JLabel("Current Bill:");
              currentL.setBounds(135,65,80,20);
              panel.add(currentL);
              currentF = new JTextField();
              currentF.setBounds(205,65,50,20);
              panel.add(currentF);*/
              JLabel dateL = new JLabel("Date:");
              dateL.setBounds(185,65,50,20);
              panel.add(dateL);
              dateF = new JTextField();
              dateF.setBounds(255,65,100,20);
              panel.add(dateF);
              registerbutton = new JButton("Register Customer");
              registerbutton.setBounds(115,100,145,20);
              registerbutton.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e){
                        insertRecord();
                        dispose();
              registerbutton.setMinimumSize(new Dimension(50,20));
              panel.add(registerbutton);
              add(panel);
              setSize(400,200);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
         public void insertRecord(){
              double bal=0.0;
              String s=depositF.getText();
              double dep = Double.parseDouble(s);
              bal+=dep;
              //String ss=dateF.getText();
              //short dd=Short.parseShort(ss);
              String ss=Double.toString(dep);
              String bb=Double.toString(bal);
              String fullName=firstnameF.getText()+"\t"+othernameF.getText();
              try{
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con=DriverManager.getConnection("jdbc:odbc:sparkletransaction","","");
                   SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yy");  //added
                   Date d = (Date)sdf.parse(dateF.getText());
                   //java.sql.Date date = new java.sql.Date();
                   //date.setTime(d.getTime());
                   String insert="INSERT INTO personaltransaction(date,name,phone,addres,deposit,balance) VALUES(?,?,?,?,?,?)";
                   //insert=insert+;
                   stat=con.prepareStatement(insert);
                   stat.setDate(1,d);
                   stat.setString(2,fullName);
                   stat.setString(3,phoneF.getText());
                   stat.setString(4,addressF.getText());
                   stat.setString(5,ss);
                   stat.setString(6,bb);
                   stat.executeUpdate();
                   stat.close();
              catch(Exception e){
                   System.out.println(e);
         public static void main(String[] arg){
              new NewCustomerRecord().setVisible(true);
    }

    java.lang.ClassCastException:java.util.Date cannot be
    cast to java.sql.Date.
    Hint:
    public static java.sql.Date convert2SqlDate(java.util.Date date) {
        return new java.sql.Date(date.getTime());
    }

  • APEX 4.0 install error - insert into wwv_flow_flash_map_regions

    Hi guys,
    just to let you know, I have just tried to install apex_4.0.zip into my local 11.2 instance on Windows7.
    I was hitting the following problem:
    insert into wwv_flow_flash_map_regions(id,file_id,region_id,region_name,centroid_x,centroid_y) values(223,9,'DNK-VBR','V
    iborg','9.06804513931274','56.6578197479248')
    FEHLER in Zeile 1:
    ORA-01722: Ungnltige Zahl
    After setting
    set NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252 before starting sqlplus and then running the apexins.sql script it worked fine.
    My NLS settings in the registry are as follows:
    NLS_LANG=GERMAN_GERMANY.WE8MSWIN1252
    Cheers,
    Dietmar.

    New files will be available between 11:30 - 12 PT that will fix this issue. Please download again after that time.
    -- Sharon

  • Error inserted into my LDAP request by Weblogic

    I have been unsuccesful trying to get LDAP working with my installation
    (wl8.1 sp2, w2k). I finally loaded a sniffer and captured packets going to
    the LDAP server to see what was being sent and I think I have found my
    problem. There is some filter entry that it; WL, does not like and it
    generates an error message BUT, WL doesn't error out it just inserts the
    error message as the filter string in the LDAP request packet; which of
    course doesn't work. How can I find out what filter it doesn't like? This is
    on the LDAP request packet NOT the reply packet so I know its coming from
    the WL server...

    If you can, the best way would be to to change the column name from SUBTYPE to something that isn't a SQL reserved key word.
    You might get around this particular problem by adding @Column(name = "\"SUBTYPE\"") on your attribute. This will force eclipselink to add quotation marks in the generated SLQ, but I think it will cause problems when it comes to some more complicated queries.
    In my opinion, the only safe way here is to not use column names that are in conflict with SLQ reserved key words.
    Pedja

  • OLEDB Syntax error INSERT INTO in DAL

    hi guys im having problems with my DAL in my school project
    before im starting new one maybe you can help me
    using
    System;
    using
    System.Collections.Generic;
    using
    System.Linq;
    using
    System.Web;
    using
    System.Data;
    using
    System.Data.OleDb;
    public
    class
    DAL
    private
    string dbPath;
    private
    OleDbConnection conn;
    private
    OleDbCommand command;
    private
    OleDbDataAdapter adpter;
    private
    string strQuery;
    public DAL(string
    dbPath)
    this.dbPath = dbPath;
    string ConnectionString =
    string.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data
    Source={0}", dbPath);
            conn =
    new
    OleDbConnection(ConnectionString);
            command =
    new
    OleDbCommand(strQuery, conn);
            adpter =
    new
    OleDbDataAdapter(command);
    public
    DataSet GetDataSet(string
    strSql)
    DataSet ds =
    new
    DataSet();
            command.CommandText = strSql;
            adpter.SelectCommand = command;
            adpter.Fill(ds);
    return (ds);
    public
    void SetDataSet(DataSet
    ds)
    OleDbCommandBuilder builder =
    new
    OleDbCommandBuilder(adpter);
            adpter.InsertCommand = builder.GetInsertCommand();
            conn.Open();
            adpter.Update(ds);
            conn.Close();
    public
    bool InsertRow(string
    sqlInsert)
    int rowsEffected;
            command.CommandText = sqlInsert;
            conn.Open();
            rowsEffected = command.ExecuteNonQuery(); // -------> the problem is here <--------
            conn.Close();
    return (rowsEffected > 0);

    Hi
    tzaxcu,
    Did you get some error information? Could you please post more information here?
    Best wishes!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Rawtohex  - How to Insert ? ORA-12899: value too large for column

    Hi,
    Can any one please help me to resolve the following issue ?
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    Name Null? Type
    ABC_OID NOT NULL RAW(8)
    ABC_NAME NOT NULL VARCHAR2(30 CHAR)
    UPDATE_TIME NOT NULL DATE
    UPDATE_BY_WORKER_NO NOT NULL NUMBER
    I'm able to insert 1st 2 records but when am inseerting 3rd one am getting error:-
    insert into caps.ABC_LOOKUP values( rawtohex('SERIES'), 'SERIES','19-FEB-09','1065449')
    insert into caps.ABC_LOOKUP values(rawtohex('FAMILY'),'FAMILY','19-FEB-09','1065449')
    Insert into caps.ABC_LOOKUP values(rawtohex('CONNECTOR'),'CONNECTOR','19-FEB-09','1065449')
    ERROR at line 1:
    ORA-12899: value too large for column
    "XYZ"."ABC_LOOKUP"."ABC_OID" (actual: 9, maximum: 8)
    Thanks in Advance.....

    Yes, Done...
    Actually I suggested same thing to them (application), But they did not agree with me then i got confused :-)
    Now the same thing worked well..Thanks a lot for your time

  • Error while inserting into ms access using jsp

    i am using the following code to insert values from textboxes into access database
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(url);
              Statement stmt=con.createStatement();
              //ResultSet rs = null;
              //String sql = ("INSERT INTO co-ords VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ");
              String sql = "INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ";
              out.println(sql);
              stmt.executeUpdate(sql);
    the output i get is
    INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('cck','28.656529681148545','77.23440170288086','28','77','39','14','23.508','3.8472') Exception:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    can somebody help me?

    Simple,
    Some error in your query right. Unable to understand Quotation stuff.
    Well understand it properly else error will follow forever :)
    Without String, Straight Away Values
    stmt1.executeUpdate("insert into Login_Details values('Example','Exmaple')");This is the query with Login_Id Pass_Word String containing the value
    stmt1.executeUpdate("insert into Login_Details values('"+Login_Id+"','"+Pass_Word+"')");Then storing sql as string and pass it in executeUpdate(sql)
    String sql="insert into Login_Details values ('example','example') "String + Values in String
    String sql="insert into Login_Details values ('"+example+"','"+example+"') "Just first it . Hope this reply solve ur SQL EXCEPTIONG
    Sachin Kokcha

  • Pl/sql block with "insert into" and schema qualified table throws "error"

    Simplified test case:
    Oracle9i EE Release 9.2.0.3.0
    Oracle JDeveloper 9.0.3.2 Build 1145
    create user u1 identified by u1
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u1;
    revoke unlimited tablespace from u1;
    create user u2 identified by u2
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u2;
    revoke unlimited tablespace from u2;
    As user u2:
    create table u2.t
    c1 number
    grant select, update, insert, delete on u2.t to u1;
    As user u1:
    create or replace package test_pkg as
    procedure do_insert (p_in number);
    end;
    create or replace package body test_pkg as
    procedure do_insert (p_in number) is
    begin
    insert into u2.t values (p_in);
    commit;
    end;
    end;
    All of the above works fine using command-line sql*plus, and is clearly a simplified version of the actual code to demonstrate the issue at hand. Using JDeveloper, it complains about 'expected ;' at the 'values' keyword in the insert statement. Removing the schema qualification from the table name allows JDeveloper to not flag the statement as an error, but I do not want to create synonyms (private or public) to point to all the tables in the real packages. Since JDeveloper flags the insert statement as an error, I can not browse the package structure etc, even though it compiles with no problems. What gives?
    Thanks in advance for any suggestions, etc...

    Hi Bryan,
    Thanks for following up on this. I will look for the bug fix to be published.
    - Mark

  • Error with INSERT INTO statement

    My INSERT statement looks like the following:
    String insert = "INSERT INTO UserDetails (lockedOut) VALUES (1)
    where registrationNo = ('"+registrationNo+"')";
    stmt.executeUpdate(insert);
    The error message:
    Missing semicolon (;) at end of SQL statement.
    I've been trying to figure this out for 2 days now - has anyone got a suggestion

    Hi.
    You need to add a semicolon inside the string.
    String insert = "INSERT INTO UserDetails (lockedOut) VALUES (1)
    where registrationNo = ('"+registrationNo+"') ; ";
    Nimo.

  • Insert into mdsys.cs_srs error

    Hi list,
    i Creating a User-Defined Coordinate System
    ERROR 1: ORA-13199:
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.CS_SRS_TRIGGER", line 2
    ORA-04088: error during execution of trigger 'MDSYS.CS_SRS_TRIGGER' in
    INSERT INTO mdsys.cs_srs
    VALUES (
    'Asia_North_Lambert_Conformal_Conic',
    102027,
    102027,
    'PROJCS["Asia_North_Lambert_Conformal_Conic",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",95],PARAMETER["Standard_Parallel_1",15],PARAMETER["Standard_Parallel_2",65],PARAMETER["Latitude_Of_Origin",30],UNIT["Meter",1],AUTHORITY["EPSG","102027"]]',
    null
    );

    several days ago i have similar problem....
    the solution was to define all necessary (missing) entries in the tables (in the following order):
    SDO_DATUMS
    SDO_COORD_OPS
    SDO_COORD_OP_PARAM_VALS
    SDO_COORD_REF_SYS
    SDO_CS_SRS
    the entries in the SDO_CS_SRS table can be automaticly updated if all other data are properly defined:
    call SDO_CS.UPDATE_WKTS_FOR_EPSG_CRS(xxx);
    refer to Oracle Spatial User Guide (chapter 6.8) how to insert data in all mentioned tables.
    my sugestion is:
    - find SRS that has similar definition like SRC you need (SRID from SDO_COORD_REF_SYS table).
    - read what is written in the SDO_COORD_REF_SYS
    - find all related entries in other tables
    - following predefine patern from predefined oracle srid add new entries with the new values for your crs parameters
    ... maybe you don't have to define new datum parameters but i think the workflow is clear.
    i have tried this aproach and for me everything works well. i'm using oracle 10g R2 and i have to add new projected coordinate system based on transverse mercator.
    regards,
    sp

  • Require sum value of one table to be inserted into another table column

    Hi
    I have a table which contains a list of parts and their prices required for an assembly.
    I am trying to calculate the total from this part lists and put into the total price column for the assembly (another table column).
    My method was to calculate the total in a page process ( eg, once all parts in the assembly have been entered the page process calculates the total price (the sum of the part prices at that time) and puts the result (total) in the assembly total column)
    In the process I capture the total using either
    SELECT SUM(TOTAL_COST) Total INTO B from CC_REQ_BOM WHERE RID = :P5_RID;
    or
    SELECT SUM(TOTAL_COST) INTO B from CC_REQ_BOM WHERE RID = :P5_RID;
    Both the above sql statements are allowed ( one with alias and one without alais) by the page process but they dont seem to be working as no total is returned to the table when the page process is run.
    to insert the calculation(variable B) into the required table I have used
    INSERT INTO CC_REQ(TOTAL_COST)
    VALUES(B);
    I have used this method a few times with no problems for standard sql statements but this is the first time I have used it with the sum SQL function. For some reason it doesn't seem to like the SUM function even though the code below works in SQL Command window.
    SELECT SUM(TOTAL_COST) from CC_REQ_BOM WHERE RID = :P5_RID;
    Any help welcome.
    PGJ

    Hi
    In that case, I would do something like this then...
    CREATE TABLE crt_crates
    (ccr_id   INTEGER        CONSTRAINT ccr_pk PRIMARY KEY,
    ccr_name VARCHAR2(4000) CONSTRAINT ccr_nam_nn NOT NULL);
    CREATE TABLE crt_requests
    (cre_id        INTEGER        CONSTRAINT cre_pk PRIMARY KEY,
    cre_reference VARCHAR2(4000) CONSTRAINT cre_ref_nn NOT NULL,
    --I've skipped the requester as this would probably refernce a different table
    --I've skipped request details as it's not necessary for this example
    cre_ccr_id    INTEGER        CONSTRAINT cre_ccr_fk REFERENCES crt_crates);
    CREATE TABLE crt_materials
    (cma_id   INTEGER        CONSTRAINT cma_pk PRIMARY KEY,
    cma_name VARCHAR2(4000) CONSTRAINT cma_nam_nn NOT NULL,
    cma_cost NUMBER(12,2)   CONSTRAINT cma_cos_nn NOT NULL);
    CREATE TABLE crt_crate_bom
    (ccb_id       INTEGER CONSTRAINT ccb_pk PRIMARY KEY,
    ccb_ccr_id   INTEGER CONSTRAINT ccb_ccr_fk REFERENCES crt_crates,
    ccb_cma_id   INTEGER CONSTRAINT ccb_cma_fk REFERENCES crt_materials,
    ccb_quantity INTEGER DEFAULT 1 CONSTRAINT ccb_qua_nn NOT NULL);
    INSERT INTO crt_crates
    VALUES(1, 'Crate 1');
    INSERT INTO crt_requests
    VALUES(1,'Request 1',1);
    INSERT INTO crt_materials
    VALUES(1,'Material 1', 1000);
    INSERT INTO crt_materials
    VALUES(2,'Material 2', 500);
    INSERT INTO crt_crate_bom
    VALUES(1,1,1,5);
    INSERT INTO crt_crate_bom
    VALUES(2,1,2,3);
    COMMIT;
    --So crate cost totals would be...
    SELECT cre_reference              request,
           ccr_name                   crate,
           SUM(cma_cost*ccb_quantity) crate_cost
    FROM   crt_requests,
           crt_crates,
           crt_materials,
           crt_crate_bom
    WHERE  cre_ccr_id = ccr_id
    AND    ccb_ccr_id = ccr_id
    AND    ccb_cma_id = cma_id
    GROUP BY cre_reference,
             ccr_name;
    --And request cost totals would be...
    SELECT cre_reference              request,
           SUM(cma_cost*ccb_quantity) crate_cost
    FROM   crt_requests,
           crt_crates,
           crt_materials,
           crt_crate_bom
    WHERE  cre_ccr_id = ccr_id
    AND    ccb_ccr_id = ccr_id
    AND    ccb_cma_id = cma_id
    GROUP BY cre_reference; Do you see what I mean - you don't store the derived values as they could get out of sync with the component parts that make then up. You derive them from the underlying data instead.
    Hope this makes sense.
    Cheers
    Ben

  • Error when inserting into a table

    Hi,
    I am running this insert stmt
    SQL> insert into cntct select * from CUSTSRV_ADMN.cntct_bk1;
    ERROR at line 1:
    ORA-01733: virtual column not allowed here
    Below is the table structure.
    SQL> desc cntct;
    Name Null? Type
    CNTCT_KEY NOT NULL NUMBER(10)
    CNTCT_NUM NOT NULL CHAR(12)
    SRC_SYS_DESC NOT NULL VARCHAR2(5)
    ACTVTY_DT NOT NULL DATE
    CNTCT_TYPE_DESC NOT NULL VARCHAR2(15)
    CNTCT_INIATR_CD NOT NULL CHAR(1)
    CNTCT_INIATR_DESC NOT NULL VARCHAR2(10)
    CNTCT_INIATR_NAME NOT NULL VARCHAR2(30)
    CNTCT_INIATR_PHONE_NUM VARCHAR2
    CNTCT_STUS_CD NOT NULL CHAR(1)
    CNTCT_STUS_DESC NOT NULL VARCHAR2(10)
    CNTCT_AGE_DAYS_CNT NOT NULL NUMBER(4)
    CNTCT_ELPSD_TIME_SEC_CNT NOT NULL NUMBER(10)
    CNTCT_RCVD_DT NOT NULL DATE
    CNTCT_OPEN_DT NOT NULL DATE
    CNTCT_RSLTN_DT NOT NULL DATE
    CNTCT_NEW_IND NOT NULL CHAR(1)
    HIGHST_NMIS_CD NOT NULL NUMBER(1)
    INIATNG_AGENT_KEY NOT NULL NUMBER(5)
    CLSNG_AGENT_KEY NOT NULL NUMBER(5)
    CNTCT_ID NOT NULL VARCHAR2(20)
    IMG_NUM NOT NULL VARCHAR2(13)
    PRVDR_NPI NOT NULL VARCHAR2(10)
    PRVDR_TIN NOT NULL VARCHAR2(9)
    CNTCT_OPEN_DTIME NOT NULL DATE
    CNTCT_RSLTN_DTIME NOT NULL DATE
    Please advise.
    Regards,
    Narayan

    No its another table.
    I also tried using columns instead of '*'
    SQL> insert into cntct
    2 select CNTCT_KEY,
    3 CNTCT_NUM,
    4 SRC_SYS_DESC,
    5 ACTVTY_DT,
    6 CNTCT_TYPE_DESC,
    7 CNTCT_INIATR_CD,
    8 CNTCT_INIATR_DESC,
    9 CNTCT_INIATR_NAME,
    10 CNTCT_INIATR_PHONE_NUM,
    11 CNTCT_STUS_CD,
    12 CNTCT_STUS_DESC,
    13 CNTCT_AGE_DAYS_CNT,
    14 CNTCT_ELPSD_TIME_SEC_CNT,
    15 CNTCT_RCVD_DT,
    16 CNTCT_OPEN_DT,
    17 CNTCT_RSLTN_DT,
    18 CNTCT_NEW_IND,
    19 HIGHST_NMIS_CD,
    20 INIATNG_AGENT_KEY,
    21 CLSNG_AGENT_KEY,
    22 CNTCT_ID,
    23 IMG_NUM,
    24 PRVDR_NPI,
    25 PRVDR_TIN,
    26 CNTCT_OPEN_DTIME,
    27 CNTCT_RSLTN_DTIME
    28 from CUSTSRV_ADMN.cntct_bk1;
    Still have the same error.
    insert into cntct
    ERROR at line 1:
    ORA-01733: virtual column not allowed here
    Please advise.
    Regards,
    Narayan

  • MULTIPLE VALUES INSERTION INTO MULTIPLE TEXTBOXES

    I HAVE TO INSERT DATA INTO DATABASE TABLE FROM TEXTBOXES.DTABASE STRUCTURE
    table name Insert_damo_1
    name nvarchar(50)
    lastname nvarchar(50)
    addr  nvarchar(50)
    C# CODING
            SqlConnection cnn1 = new SqlConnection("my connection string");
            cnn1.Open();
            SqlCommand cmd;
            String[] nam1 = {TextBox1.Text,TextBox2.Text,TextBox3.Text };
            foreach (String na in nam1)
                cmd = new SqlCommand("insert into Insert_damo_1(name) values(@name)",cnn1);
                cmd.Parameters.AddWithValue("@name",na);
                cmd.ExecuteNonQuery();
            String[] last1 = { TextBox4.Text, TextBox5.Text, TextBox6.Text };
            foreach (String la1 in last1)
                cmd = new SqlCommand("insert into Insert_damo_1(lastname) values(@lastname)", cnn1);
                cmd.Parameters.AddWithValue("@lastname", la1);
                cmd.ExecuteNonQuery();
            String[] ad1 = { TextBox7.Text, TextBox8.Text, TextBox9.Text };
            foreach (String a1 in ad1)
                cmd = new SqlCommand("insert into Insert_damo_1(addr) values(@addr)", cnn1);
                cmd.Parameters.AddWithValue("@addr", a1);
                cmd.ExecuteNonQuery();
            cnn1.Close();
            Response.Write("insert successful");
    I GOT THE RESULT AS
    name          lastname
     address
    a                  null                     null
    b                  null                     null
    c                  null                     null
    null             d                         null
    null             e                         null
    null             f                          null
    null            null                      g
    null            null                      h
    null            null                      i
    1. I WANT RESULT WITHOUT NULL
    2. IF USER DOES'T INSERT ANYTHING IN A TEXT BOX THEN ONLY NULL IS INSERTED AT THAT PLACE
    ANY HELP WILL BE DEEPLY APPRECIATED.
    THANK YOU. 

    Try this
    cnn1.Open();
    SqlCommand cmd;
    String[] nam1 = {TextBox1.Text,TextBox2.Text,TextBox3.Text };
    String[] last1 = { TextBox4.Text, TextBox5.Text, TextBox6.Text };
    String[] ad1 = { TextBox7.Text, TextBox8.Text, TextBox9.Text };
    cmd = new SqlCommand("insert into Insert_damo_1(name,lastname,addr) values(@name,@lastname,@addr)",cnn1);
    cmd.Parameters.Add("@name", SqlDbType.VarChar);
    cmd.Parameters.Add("@lastname", SqlDbType.VarChar);
    cmd.Parameters("@addr", SqlDbType.VarChar);
    for(int i; i < nam1.Length; i++)
    cmd.Parameters["@name"].Value = nam1[i];
    cmd.Parameters["@lastname"].Value = last1[i];
    cmd.Parameters["@addr"].Value = last1[i];
    cmd.ExecuteNonQuery();
    cnn1.Close();
    Response.Write("insert successful");
    jdweng

Maybe you are looking for

  • Mail notifications

    I'm a new MacBook Pro user as of yesterday. I do not seem to be getting any notifications from Mail, even though it is open and I have the notifications set to Banner. Can anyone help me?

  • Disc ejects before completion in iDVD

    Hi, firstly I'm a little behind the times having only recently upgraded to Snow Leopard, my problem is iDVD. I have a collection of images that I am trying to burn via iDVD all goes well until the burning, the disc ejects about 8 minutes before compl

  • How to connect to web services from iOS to get list using anonymous access

    Hello This is a public facing web site that I would like to have access to a list file to get data in an iOS app however I get 403 forbidden because I do not have a username and password.   How can I get this list with anonymous access?   Under my ad

  • SapConsole SAP Note to suppress TO creation std message

    Hi All, We are using SAPCONSOLE not the WEB SAPCONSOLE. We dont want the standard message that appears after TO creation on console screen. Kindly suggest any SAPNOTE which can be useful for this purpose. We want that any further RF tcodes created wi

  • Ios 8 keeps crashing on my iPad 2. Has anyone got a solution to this. My iPad 2 was great before upgrading.

    ios 8 keeps crashing on my iPad 2. Has anyone got a solution to this. My iPad 2 was great before upgrading. It's so bad that now I want to throw my iPad out so if anyone has tips to enhance my iPads performance please share.