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());
}

Similar Messages

  • XML document convert into String and Insert into Database

    Hello all,
         In the FIle to File Scenario  I want to send the data to the Reciever System in xml Document and convert into String and insert into Database.
      Please can you tell me exact way how to send it.
    Thanks & Regards,
    Raj

    HI,
    As per my understanding your scenario is File to file where you will get output fiel in XML format.
    Now that XMl payload need to be passed as single string in the database via XI.
    You cauld do this but you need to imply some manipulations such as
    With the help of standard API you need to concatenate the  XML tags and create the structre along with the data.
    For e.g. in your outpuf file the XML structre contain data as
    <field1>ABCD</field1>
    Then in mapping
    The source field will be mappeda s concat(<field1>) + value of  Source field "ABCD" + concat(</field1>) to the target field.
    This is the way that you could achive the requirments else there is no direct way avaialble for it.
    thanks
    Swarup

  • Pool data from text file and insert into database

    Can anyone tell me how to pool data from a text file and insert into database?
    let's say my text file is in this format
    123456 Peter 22
    234567 Nicholas 24
    345678 Jane 20
    Then I need to insert the all the value for this three column into a table which has the three column name ID, Name, Age
    Anyone knows? I need to do this urgently...Thank in advanced

    1. Use BufferedReader and read the file line by line.
    2. Loop thru the file and do the following steps with in this loop.
    3. Use StringTokenizer to seperate each line into three values (columns).
    4. Now create a insert statement with these values and add the statement to the batch (using addBatch() method of PreparedStatement or Statement).
    5. Finally (after exiting the loop), execute these batch of statements (using ps.executeBatch()).
    Sudha

  • Date not changing based on timezone during insert into database...

    I have a bpel project that gets data in GMT and insert into a database that's based on EST timezone...for some reason during insert into database, I expect it to reflect the time in EST time, but it's not doing so. It's a standard oracle bpel project and there was no customization to the date input. The following are the details:
    input data:
    <InvoiceDate>
    <GLogDate>20110613213249</GLogDate>
    <TZId>UTC</TZId>
    <TZOffset>+00:00</TZOffset>
    </InvoiceDate>
    date I get after transformation:
    <ns5:invoiceDate> 2011-06-13T21:32:49 </ns5:invoiceDate>
    date that gets inserted into the database:
    6/13/2011 9:32:49 PM
    Any thoughts as to what's going on? Is this the intended fuctionality or how does it adjust itself to the daylight saving? I thought database itself would handle it in this case.
    Thanks,
    Amkay

    WpgMom --
    From your description, it sounds totally like you are using Manually Scheduled tasks, which is not what you should be using in your project.  If you look at the Gantt bars in the Gantt Chart view of your project, if the Gantt bars are a turquoise color,
    you are using Manually Scheduled tasks, and that would be the reason that the dates do not automatically calculate for you.  If this is the case, click the Select All button to select every task in the project.  In the Tasks section of your Task
    ribbon, click the Auto Schedule button.  From this point forward, your project schedule will automatically recalculate every time you make any kind of schedule edit.
    Also, in the lower left corner of the Microsoft Project application window, you will probably see a button that says New Tasks: Manually Scheduled.  Click this button and select the Auto Scheduled option.
    To avoid all of these problems in all future projects, click File > Options.  In the Project Options dialog, click the Schedule tab.  In the Scheduling Options for This Project section, click the pick list where you see the name of your project
    and select the All New Projects item on the pick list.  Click the New Tasks Created pick list and select the Auto Scheduled option.  Click the OK button.
    Hope this helps.
    Dale A. Howard [MVP]

  • Error while insert into database using DB adpater for Field BLOB

    Hello All
    I am trying to tranfer data from Database A to Database B using Oracle DB adapter.
    Table of databse A contains field BLOB, which cotains the resume /doc file.After transformation in Database B format ,while invoking the DB adapter to insert, I am getting follwing error
    <bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="code"><code>null</code>
    </part><part name="summary"><summary>file:/u01/bpelvinc/product/10.1.3.1/OracleAS_1/bpel/domains/viapps/tmp/.bpel_ERecuit_Application_New_1.0_d1c2b2149a9e0c7c745279667ad1fc84.tmp/DB_APPL_111.wsdl [ DB_APPL_111_ptt::insert(RtmApplicantCollection) ] - WSIF JCA Execute of operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [DBAPPL111.RtmApplicant]. [Caused by: Error in encoded stream, got 2]
    ; nested exception is:
         ORABPEL-11616
    DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [DBAPPL111.RtmApplicant]. [Caused by: Error in encoded stream, got 2]
    Caused by Exception [TOPLINK-3001] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070608)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [xs:base64Binary 43524541544520544193B0D0A], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp].
    Internal Exception: java.io.IOException: Error in encoded stream, got 2.
    </summary>
    </part><part name="detail"><detail>
    Exception Description: The object [xs:base64Binary 4352E616D65293B0D0A], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp].
    Internal Exception: java.io.IOException: Error in encoded stream, got 2</detail>
    </part></bindingFault>
    Please let me know ,what are the possibilities.
    Thanks
    Satendra

    Hi...
    well... My flow goes like Pl/SQl ---> BPEL,
    Now PL/SQL code reads data from the Database A and Send it to BPEL which inserts into the Database B.
    with respest to above design, I found the problem in pl/sql block.
    Actually I am sending a BLOB field in the soap message. but some how pl/sql now ablt tot handle that or sending some wrong data.
    my question is how to send a blob filed data to bpel using pl/sql block. this the reasion I am getting above error.
    Thanks

  • URGENT - Insert into database error

    Hi people.
    I am using this code to insert multiple records into a table from a multi select box.
    Sometimes it works, other times It throws an error saying:
    Error. [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
    Why would this be? and how can I fix this?
    <%
    int memberId = 0;
    int groupId = Integer.parseInt(request.getParameter("groupId"));
    String[] x = request.getParameterValues("totalUsers");
    String groupName = "";
    String name = "";
    String groupId2 = "";
    String name2 = "";
    int m = x.length;
    String query = "SELECT MemberID FROM tGroup_X_Member WHERE (MemberID IN (SELECT memberID FROM tGroup_X_Member WHERE (MemberID IN (SELECT UogID FROM tSubject WHERE Name IN (SELECT CallerName FROM CALLS WHERE CallerName = ?)))))";
    String insertQuery = "INSERT INTO tGroup_X_Member(MemberID, GroupID)" + "VALUES (?, ?)";
    Connection conn = null;
    PreparedStatement prep = null;
    PreparedStatement prep2 = null;
    ResultSet rSet = null;
    try {
    DBConnection db = new DBConnection();
    conn = db.conn;
    conn.setAutoCommit(false);
    prep = conn.prepareStatement(query);
    prep2 = conn.prepareStatement(insertQuery);
    for (int i=0; i<m; i++) {
    prep.setString(1, x);
    ResultSet resSet = prep.executeQuery();
    if (resSet.next()) {
    memberId = resSet.getInt(1);
    prep2.setInt(1, memberId);
    prep2.setInt(2, groupId);
    prep2.executeUpdate();
    conn.commit();
    response.sendRedirect("modifyGroupExpand.jsp?groups=" + groupId);
    } catch (Exception ex) {
    try {conn.rollback();} catch (Exception ex1) {ex1.printStackTrace();}
    out.println("Error. " + ex.getMessage());
    finally {
    try {rSet.close();} catch (Exception ex1) {ex1.printStackTrace();}
    try {prep.close();} catch (Exception ex1) {ex1.printStackTrace();}
    try {prep2.close();} catch (Exception ex1) {ex1.printStackTrace();}
    try {conn.close();} catch (Exception ex1) {ex1.printStackTrace();}
    }%>
    Thanks

    Looks like you might be trying to insert a row before all of the rows are returned from the query, this is possible - how many rows do you get back on the members that fail the insert?
    You could create a seperate connection for the inserts or move to your last row before starting to insert.
    Secondly, your query seems very intense with all the sub selects. Will the following not work?
    Select tGroup_X_Member.MemberId
    From tGroup_X_Member, tSubject, CALLS
    Where tGroup_X_Member.MemberID = tSubject.UogID And
    tSubject.Name = CALLS.CallerName And
    CALLS.CallerName = ?

  • Date Format in servlet when i insert into database

    I am inserting data into database through servlet, but i am getting NumberFormat Exception, and my datatype in database is DATE ,when i typecast my day and year because they r in int and changing into String,still i am getting the same error .So please can any one tell me where to cahnge the format of date and how to type cast to my Date format of database.
    Thanks,
    lalitha

    My code is:import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.text.*;
    import java.sql.Date;
    import java.util.*;
    public class RegisterServlet extends HttpServlet
         Connection con;
         PreparedStatement ps;
    public void init(ServletConfig sc) throws ServletException
         try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con=DriverManager.getConnection("jdbc:odbc:plk","scott","tiger");
         System.out.println("connection created");
         catch(Exception e)
         System.out.println(e);
    public void doPost(HttpServletRequest req, HttpServletResponse res)
         try
         res.setContentType("text/html");
         PrintWriter pw= res.getWriter();
    String ulogin=req.getParameter("login").trim();
    String uph1=req.getParameter("ph1").trim();
    int ph1=Integer.parseInt(uph1);
    String upass=req.getParameter("pass").trim();
    String uph2=req.getParameter("ph2").trim();
    int ph2=Integer.parseInt(uph2);
    String cpass=req.getParameter("cfm").trim();
    String uweb=req.getParameter("web").trim();
    String ufirst=req.getParameter("first").trim();
    String uaddress=req.getParameter("address").trim();
    String umiddle=req.getParameter("middle").trim();
    String ucity=req.getParameter("city").trim();
    String ulast=req.getParameter("last").trim();
    String uzip=req.getParameter("zip").trim();
    int zip=Integer.parseInt(uzip);
    String ud=req.getParameter("Aday").trim();
    String um=req.getParameter("Amonth").trim();
    String uy=req.getParameter("Ayear").trim();
    SimpleDateFormat din=new SimpleDateFormat("dd-mm-yyyy");
    SimpleDateFormat dout=new SimpleDateFormat("yyyy/mm/dd");
    String txtDate="2001-07-07";
    Date date=din.parse(txtDate);
    java.sql.Date dt=new java.sql.Date(txtDate);
    dout.format(dt);
    String usex=req.getParameter("sex").trim();
    String uemail=req.getParameter("email").trim();
    String ust=req.getParameter("st").trim();
    String ucty=req.getParameter("cty").trim();
    ps=con.prepareStatement("insert into Userdetails values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
    ps.setString(1,ulogin);
    ps.setString(2,uph1);
    ps.setString(3,upass);
    ps.setString(4,uph2);
    ps.setString(5,cpass);
    ps.setString(6,uweb);
    ps.setString(7,ufirst);
    ps.setString(8,uaddress);
    ps.setString(9,umiddle);
    ps.setString(10,ucity);
    ps.setString(11,ulast);
    ps.setString(12,uzip);
    ps.setDate(13,dt);
    ps.setString(14,usex);
    ps.setString(15,uemail);
    ps.setString(16,ust);
    ps.setString(17,ucty);
    int i=ps.executeUpdate();
    if(i==1)
    pw.println("<h3><center> Thankyou! Your details have been stored. </center></h3>");
    res.sendRedirect("http://localhost:8080/SeekLogin.html");
    pw.close();
    else
         pw.println("<h3><center>Sorry! you are not registered properly. </center></h3>");
    pw.close();
    catch(Exception e)
         System.out.println(e);
    Can anyone look this code and help me out where i am doing the mistake.
    Thanks.

  • How to insert into database using jsp

    sir
    the code below is to enter the items in the database but it is giving the error .......of null.................
    <!-- JAI SHRI RAM -->
    <%@ page import="java.sql.*" %>
    <html>
    <head><title>JAI SHRI RAM</title></head>
    <body>
    <%
    String url = "jdbc:odbc:lala" ;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection(url,"","");
    Statement st = conn.createStatement();
    for(int i=1 ; i<=13 ; i++)
    String skill_type = request.getParameter("skill_type"+i);
    String skill_name = request.getParameter("skill_name"+i);
    String version = request.getParameter("version"+i);
    String lastused = request.getParameter("last_used"+i);
    int last_used = Integer.parseInt(lastused);
    String proficiency_level = request.getParameter("proficiency_level"+i);
    String expinyears = request.getParameter("exp_in_years"+i);
    int exp_in_years = Integer.parseInt(expinyears);
    String expinmonths = request.getParameter("exp_in_months"+i);
    int exp_in_months = Integer.parseInt(expinmonths);
    String query = "insert into skills values(1 , '" + skill_type + "' , '" + skill_name + "', '" + version + "', 1 , '" + proficiency_level + "', 1 ,1)";
    st.executeUpdate(query);
    out.println("JAI SHRI RAM ,,,,,,,, transcation is over");
    %>
    </body>
    </html>
    i m using MS ACCESS
    please tell me the problem
    thank you
    gaurav

    Hi,
    Most probably you have problem in proper initialization of the database driver or the connection url.
    In lines shown bellow
    String url = "jdbc:odbc:lala" ;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection(url,"","");Try to do that with more simple operations e.g. insert in a table with one field.

  • Cannot insert into database

    Can any body help plzzzzzzzzzzzzzzzz,
    I establish a connection using connection pooling as given in netbeans
    helps.With that ican retrieve data from database but cant insert into it.While inserting only null values ere entered into database.why?
    please somebody help

    My Jsp page userRegistration.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
    <%@ page import="java.sql.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
            </head>
        <body>
    <html:errors/>
        <table>
    <html:form action="reg.do"method="post" >
    <tr>
    <td>
    firstname<html:text  property="firstName"  />
    </td>
    </tr>
    <tr>
    <td>
    lastname<html:text property="lastName" />
    </td>
    </tr>
    <tr>
    <td>
    username<html:text property="userName" />
    </td>
    </tr>
    <tr><td>
    email<html:text property="email" />
    </td>
    </tr>
    <tr>
    <td>
    phone<html:text property="phone" />
    </td>
    </tr>
    <tr>
    <td>
    fax<html:text property="fax" />
    </td>
    </tr>
    <tr>
    <td>
    password<html:password property="password" />
    </td>
    </tr>
    <tr><td>
    passwordcheck<html:password property="passwordCheck" />
    </td>
    </tr>
    <tr>
    <td>
    <html:submit />
    </td>
    <td>
    <html:cancel />
    </td>
    </tr>
    </table>
    </html:form>
    </body>
    </html>
    my struts action
    package action;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionForward;
    import javax.servlet.http.HttpSession;
    public class reg extends Action {
         private String firstName;
        private String lastName;
        private String userName;
               private String email;
               private String phone;
               private String fax;
               private String password;
               private String passwordCheck;
        /* forward name="success" path="" */
        private final static String SUCCESS = "success";
        public ActionForward execute(ActionMapping mapping, ActionForm  form,
                HttpServletRequest request, HttpServletResponse response)
                throws Exception {
            response.sendRedirect("complete.jsp");
            return mapping.findForward(getSUCCESS());
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getUserName() {
            return userName;
        public void setUserName(String userName) {
            this.userName = userName;
        public String getEmail() {
            return email;
        public void setEmail(String email) {
            this.email = email;
        public String getPhone() {
            return phone;
        public void setPhone(String phone) {
            this.phone = phone;
        public String getFax() {
            return fax;
        public void setFax(String fax) {
            this.fax = fax;
        public String getPassword() {
            return password;
        public void setPassword(String password) {
            this.password = password;
        public String getPasswordCheck() {
            return passwordCheck;
        public void setPasswordCheck(String passwordCheck) {
            this.passwordCheck = passwordCheck;
        public static String getSUCCESS() {
            return SUCCESS;
        private javax.sql.DataSource getHima() throws javax.naming.NamingException {
            javax.naming.Context c = new javax.naming.InitialContext();
            return (javax.sql.DataSource) c.lookup("java:comp/env/jdbc/hima");
    my complete.jsp where insertion happens
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
    <%@ page import="java.sql.*" %>
    String firstName=("firstName");
    String lastName = getInitParameter("lastName");
    String userName = getInitParameter("userName");
    String email= getInitParameter("email");
    String phone = getInitParameter("phone");
    String fax = getInitParameter("fax");
    String password = getInitParameter("password");
    String passwordCheck = getInitParameter("passwordCheck");
    <%
           String firstName=(String)request.getAttribute("firstName");
           request.getSession().setAttribute("firstName",firstName);
    %>  
    <sql:query var="queryresults" dataSource="jdbc/hima">
            select phone from user
            </sql:query>
    <sql:update var="resultset" dataSource="jdbc/hima">
                INSERT INTO user1 (firstName,lastName,userName,email,phone,fax,password,passwordCheck)
                VALUES(firstName,lastName,userName,email,phone,fax,password,passwordCheck)
            </sql:update>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
       <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
    <form action="comp"></form>
        <h1>JSP Page</h1>
        <table>
        <tr>
        <th>first</th>
        </tr>
        <c:forEach var="row" items="${queryresults.rows}">
            <tr>
            <td><c:out value="${row.phone}"/></td>
            </tr>
        </c:forEach>
    </table>
        </body>
    </html>

  • 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

  • Trigger a process when a record is inserted into database

    Hi, could someone tell me how to do the following (if it's possible):
    when a record is inserted into a table in a database,
    I want it to somehow trigger an action which will put an item into user's To-Do inBox of the WorkSpace,
    the user can then open the form in the To-Do and use it to view the data in the newly inserted record.
    this "user"'s login ID is part of the inserted record.
    thanks

    Mmm, trigger?  I don't know of a way.
    But I supposed you could have a process that has a timer that peroidically queries the database for changes and then do the same thing.
    You could also perhaps write a Service and then use the Java API to start a process?
    Maybe take a look here
    http://blogs.adobe.com/livecycle/2010/12/how-to-invoke-a-livecycle-process-periodically.ht ml

  • 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.

  • Insert into database table

    Hi Guy's,
    Please help me, trying to insert the records into database table. when i debug the program work area contain  data records  but not insert into databse table.  Here pasted my code pls suggest me where i did mistake.
    FUNCTION ZEXM_PHOTOCOPYDTLS_EP.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(EXMCODE) TYPE  ZEXMCODE OPTIONAL
    *"     VALUE(EXMMONTH) TYPE  ZEXMMONTH OPTIONAL
    *"     VALUE(SEATNO) TYPE  ZSEATNO OPTIONAL
    *"     VALUE(STDFIRSTNAME) TYPE  ZSTDFIRSTNAME OPTIONAL
    *"     VALUE(STDMIDDLENAME) TYPE  ZSTDMIDDLENAME OPTIONAL
    *"     VALUE(STDLASTNAME) TYPE  ZSTDLASTNAME OPTIONAL
    *"     VALUE(ADDLINE1) TYPE  ZADDLINE1 OPTIONAL
    *"     VALUE(CITY) TYPE  ZCITY OPTIONAL
    *"     VALUE(COUNTRY) TYPE  ZCOUNTRY OPTIONAL
    *"     VALUE(PIN) TYPE  ZPIN OPTIONAL
    *"     VALUE(TELEPHONENO) TYPE  ZTELEPHONENO OPTIONAL
    *"     VALUE(MOBNO) TYPE  ZMOBNO OPTIONAL
    *"     VALUE(EMAIL) TYPE  ZEMAIL OPTIONAL
    *"     VALUE(DDNO) TYPE  ZDDNO OPTIONAL
    *"     VALUE(DDAMT) TYPE  ZDDAMOUNT OPTIONAL
    *"     VALUE(DDDATE) TYPE  ZDDDATE OPTIONAL
    *"     VALUE(BANKNAME) TYPE  ZBANKNAME OPTIONAL
    *"     VALUE(COLNAME) TYPE  ZCOLNAME OPTIONAL
    *"     VALUE(COLADDRESS) TYPE  ZCOLADDRESS OPTIONAL
    *"     VALUE(COURSECODE) TYPE  ZCOURSECODE OPTIONAL
    *"     VALUE(EXMYEAR) TYPE  ZEXMYEAR OPTIONAL
    *"     VALUE(PAPERCODE) TYPE  ZPAPERCODE OPTIONAL
    *"     VALUE(PAPERNO) TYPE  ZPAPERNO OPTIONAL
    *"     VALUE(MARKSOBT) TYPE  ZMARKSOBT OPTIONAL
    *"     VALUE(EXMDATE) TYPE  ZEXMDATE OPTIONAL
    *"     VALUE(EXMTIME) TYPE  ZEXMTIME OPTIONAL
    *"     VALUE(SUBCODE) TYPE  ZSUBCODE OPTIONAL
    *"  EXCEPTIONS
    *"      SELECTION_ERROR
      DATA : WA_OUTPUT TYPE  ZEXM_PHOTOCOPYDT,
             WA_COLL TYPE ZEXM_COLLEGEMST,
             WA_COURSE TYPE ZEXM_COURSEMST,
             WA_EXMCODE TYPE ZEXM_EXMCODEMST,
             WA_PAPER   TYPE ZEXM_PHOPAPERMAP,
             WA_SUBJECT TYPE  ZEXM_SUBJECTMST.
    STUDENT DETAILS
      MOVE : EXMCODE     TO WA_OUTPUT-ZEXMCODE,
             EXMMONTH    TO WA_OUTPUT-ZEXMMONTH,
             SEATNO    TO WA_OUTPUT-ZSEATNO,
             STDFIRSTNAME TO WA_OUTPUT-ZSTDFIRSTNAME,
             STDMIDDLENAME TO WA_OUTPUT-ZSTDMIDDLENAME,
             STDLASTNAME TO WA_OUTPUT-ZSTDLASTNAME,
             ADDLINE1    TO WA_OUTPUT-ZADDLINE1,
             CITY        TO WA_OUTPUT-ZCITY,
             COUNTRY     TO WA_OUTPUT-ZCOUNTRY,
             PIN         TO WA_OUTPUT-ZPIN,
             TELEPHONENO TO WA_OUTPUT-ZTELEPHONENO,
             MOBNO       TO WA_OUTPUT-ZMOBNO,
             EMAIL       TO WA_OUTPUT-ZEMAIL,
             DDNO        TO WA_OUTPUT-ZDDNO,
             DDAMT       TO WA_OUTPUT-ZDDAMT,
             DDDATE      TO WA_OUTPUT-ZDDDATE,
             BANKNAME    TO WA_OUTPUT-ZBANKNAME.
    insert into ZEXM_PHOTOCOPYDT values wa_output.
    if sy-subrc = 0.
    commit work.
    endif.
    Thanks and Regards,
    Sai.
    Edited by: sai shanhu on Jun 4, 2008 11:13 AM

    Hai,
    move wa_output into ZEXM_PHOTOCOPYDT.
    insert  ZEXM_PHOTOCOPYDT.
    Thanks,
    Durai.V

  • Parse xml data and insert into database

    Hi Friends,
    I have an xml document which needs to be parsed and the data need to be inserted into an oracle database table.
    Please tell me which will be the easiest and optimal way of doing this.
    Thanks,
    Achayan

    Take a look at the JDOM xml parsing library - google for JDOM download or something.
    This will allow you to build an object representation of the XML doc, from which you can then extract the data.
    J

  • 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>

Maybe you are looking for

  • Dynamic access policy ACL not beeing applied to user

    Hi all I have just configured my ASA for ssl vpn I have created a dynamic access policy with an ACL in it. The user connects fine, and I can see on the logs that the DAP policy has applied to the user However when I click on monitoring, it says no ac

  • I want to add a ToolTip to my Moving Marquee , But what code/widget must I use?

    Alright I have a moving marquee ,Its a slideshow with captions on it , I would like to hover over a word in the caption and display a small article in a tool tip An Image and a description , here is the DIV i am using: <div class="marquee_panel_capti

  • Real-time feedback system

    My experimental setup (labview is being used to drive it) is as follows: 1. Give the physical system a random move -> 2. Acquire data using PXI-5124 digitizer -> 3. Perform some calculation on the data acquired -> 4. Accept/ reject the move based on

  • Contacts Randomly Disappeared

    My contacts randomly disappeared in my iPhone 4s. It is brand new, and I just got it a few days ago. I had retrieved all my old contacts from iCloud but then they suddenly disappeared randomly. My contacts on iCloud.com are gone as well. I tried Impo

  • FYI - Authorize Net down due to fire in Seattle data center

    Wow - For the first time in over 6 years in dealing with Authorize Net, they are down!  Big time! For up to the minute info follow their Twitter account... http://twitter.com/authorizenet Hope they are back up soon. Lawrence   *Adobe Community Expert