JDBC- How Update record using preparedStatement() into  MS Access?

Actually i got an error when i update the record,The setString() Parameter are stored in terms of arrays .
The Error is
ErrorSQL3.java.sql.SQLException:[Microsoft][ODBC Microsft Access Driver] Syntax Error in UPDATE Statement

Actually i got an error when i update the record,The
setString() Parameter are stored in terms of arrays
The Error is
ErrorSQL3.java.sql.SQLException:[Microsoft][ODBC
Microsft Access Driver] Syntax Error in UPDATE
Statement
Believe the error message - your SQL syntax is wrong.
Either fix it or post what you have and get some advice.
%

Similar Messages

  • Updating record using toplink

    Hi,
    By registering the populated java object with the unit of work will insert a new record in the database.How about updating an existing record using UOW?
    If any sample code, it will be very helpful.
    thanks
    vasu

    http://otn.oracle.com/products/ias/toplink/technical/unitOfWorkWP.pdf
    http://otn.oracle.com/products/ias/toplink/index.html
    http://download-west.oracle.com/docs/cd/B10464_01/index.htm

  • Update record using SQL statement

    I have VB6.0 and Oracle 10G Express Edition in Windows 2000 Server. My procedure in VB 6.0 can't update record in the table using SQL statement, and the Error Message is " Missing SET keyword ".
    The SQL statement in VB6.0 look like this :
    General Declaration
    Dim conn as New ADODB.Connection
    Dim rs as New ADODB.Recordset
    Private Sub Command1_Click()
    dim sql as string
    sql = " UPDATE my_table " & _
    " SET Name = ' " & Text3.Text & " ' " & _
    " AND Unit = ' " & Text2.Text & " ' " & _
    " WHERE ID = ' " & Text1.Text & " ' "
    conn.Execute (sql)
    Private Sub Form Load()
    Set conn = New ADODB.Connection
    conn.Open "Provider=MSDASQL;" & "Data Source=my_table;"& "User ID =marketing;" & "Password=pass123;"
    I'm sorry about my language.
    What's wrong in my SQL statement, I need help ........ asap
    Best Regards,
    /Harso Adjie

    The syntax should be
    UPDATE TABLE XX
    SET FLD_1 = 'xxxx',
    FLD_2 = 'YYYY'
    WHERE ...
    'AND' is improperly placed in the SET.

  • Updated records using Dynamic FORMS_DDL

    Hello everybody:
    I need help for you guys. I'm working with Form9i and created a push button that when I press it, it should be updated some record depending of some conditions. I read that with dynamics FORMS_DDL, I can able to perform it, but when I put the below code in the “WHEN-BUTTON-PRESSED” trigger I get an “Error” that meaning that the forms was not success. Please, somebody tell me where is the error. Thanks.
    if (:CONTROL_BTN.CHK_FINAL = 'N') then
         forms_ddl('update aapt_checklists
                                            set achk_reviewed_date = ' || :CONTROL_BTN.DATE_LETTER ||
    ' where achk_item in (select achk_item
                                            from aapt_checklists, aapt_reviews
                             where ' || :global.where_updated ||
    ' and achk_reviewed_date is null
    and achk_1st_notification_date is null
    and arev_seq = achk_arev_seq)     
    and achk_1st_notification_date is null
    and achk_reviewed_date is null');
    end if;
    if (form_success) then
         message('OK');
    else     
    message('Error');
    end if;

    You don't need dynamic SQL for that. Here is what you can do (Note the new v_fmt variable, and the update SQL below):
    DECLARE
      def_where varchar2(500) := NULL;
      v_month varchar2(2)   := :CONTROL_BLOCK.Q_MONTH;
      v_day   varchar2(2)   := :CONTROL_BLOCK.Q_DAY;
      v_year  varchar2(4)   := :CONTROL_BLOCK.Q_YEAR;
      v_fmt   varchar2(10);
      v_date varchar2(20) := NULL;
    PROCEDURE check_date (in_date IN varchar2) IS
      al_id     Alert;
      al_button Number;
      temp_date date := NULL;
    BEGIN
      temp_date := to_date(in_date, 'MM/DD/YYYY');
    EXCEPTION
      when others then
        al_id := Find_Alert('CFG_ERROR');
        Set_Alert_Property(al_id, alert_message_text, 'You have selected an Invalid Date');
        al_button := Show_Alert( al_id );
        raise FORM_TRIGGER_FAILURE;
    END;
    BEGIN
      -- Criteria entered as MM/DD/YYYY
      if (v_month <> '00') and (v_day <> '00') and (v_year <> '0000') then
        v_date := v_month||'/'||v_day||'/'||v_year;
        v_fmt  := 'MM/DD/YYYY';
        check_date (v_date);
      -- Criteria entered as MM/DD
      elsif (v_month <> '00') and (v_day <> '00') and (v_year = '0000') then
        v_date := v_month||'/'||v_day;
        v_fmt  := 'MM/DD';
        check_date (v_date||'/'||'2000'); -- Hardcoded 2000 to check all possible MM/DD combos including Leap Year
        def_where := ' to_char(arev_appl_received_date, ''MM/DD'') = ''' || v_date || '''';
      -- Criteria entered as MM/YYYY
      elsif (v_month <> '00') and (v_day = '00') and (v_year <> '0000') then
        v_date := v_month||'/'||v_year;
        v_fmt  := 'MM/YYYY';
        def_where := ' to_char(arev_appl_received_date, ''MM/YYYY'') = ''' || v_date || '''';
      -- Criteria entered as MM
      elsif (v_month <> '00') and (v_day = '00') and (v_year = '0000') then
        v_date := v_month;
        v_fmt  := 'MM';
        def_where := ' to_char(arev_appl_received_date, ''MM'') = ''' || v_date || '''';
      -- Criteria entered as DD/YYYY
      elsif (v_month = '00') and (v_day <> '00') and (v_year <> '0000') then
        v_date := v_day||'/'||v_year;
        v_fmt  := 'DD/YYYY';
        def_where := ' to_char(arev_appl_received_date, ''DD/YYYY'') = ''' || v_date || '''';
      -- Criteria entered as DD
      elsif (v_month = '00') and (v_day <> '00') and (v_year = '0000') then
        v_date := v_day;
        v_fmt  := 'DD';
        def_where := ' to_char(arev_appl_received_date, ''DD'') = ''' || v_date || '''';
      -- Criteria entered as YYYY
      elsif (v_month = '00') and (v_day = '00') and (v_year <> '0000') then
        v_date := v_year;
        v_fmt  := 'YYYY';
        def_where := ' to_char(arev_appl_received_date, ''YYYY'') = ''' || v_date || '''';
      end if;
      update aapt_checklists
        set achk_reviewed_date = :CONTROL_BTN.DATE_LETTER
        where achk_item in
        in (select achk_item
                from aapt_checklists, aapt_reviews
                where to_char(arev_appl_received_date,v_fmt) = v_date
                    and achk_reviewed_date is null
                    and achk_1st_notification_date is null
                    and arev_seq = achk_arev_seq)
            and achk_1st_notification_date is null
            and achk_reviewed_date is null;
      --Condition for updated records in aapt.checklists table
      :global.where_updated := def_where;
      --Only when "INCOMPLETE - NEED ADD'L INFO" Status is selected
      def_where := def_where || ' and arev_status = 1427';
    END;

  • How to input sound file into MS Access Database, not random folder?

    Hi, I am trying to input a sound file into an MS Access 2000 database, I know it can be copied and pasted into there, but how can u input into the database with a user record, i also need the code to extract it as well as inputting it....at the moment it records the sound and stores it as test.wav on the local drive....
    here is my code for my applet do far....
    compile this file first....
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import java.io.IOException;
    import java.io.File;
    import java.net.URL;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.TargetDataLine;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.AudioFileFormat;
    public class VoicePasswordRecorder extends Thread {
         private TargetDataLine m_line;
         private AudioFileFormat.Type m_targetType;
         private AudioInputStream m_audioInputStream;
         private File m_outputFile;
         public VoicePasswordRecorder(TargetDataLine line,
                             AudioFileFormat.Type targetType,
                             File file)
              m_line = line;
              m_audioInputStream = new AudioInputStream(line);
              m_targetType = targetType;
              m_outputFile = file;
         /** Starts the recording.
             (i) The line is started,
              (ii) The thread is started,
         public void start()
              /* Starting the TargetDataLine. It tells the line that
                 data needs to be read from it. If this method isn't
                 called then it won't be able to read data from the line.
              m_line.start();
              /* Starting the thread. This call results in the
                 method 'run()'being called. There, the
                 data is actually read from the line.
              super.start();
         /** Stops the recording.
             Note that stopping the thread is not necessary. Once
             no more data can be read from the TargetDataLine, no more data
             can be read from the AudioInputStream. The method 'AudioSystem.write()'
             (called in 'run()' returns. Returning from 'AudioSystem.write()'
             is followed by returning from 'run()', and then the thread
             stops automatically.
         public void stopRecording()
              m_line.stop();
              m_line.close();
         /** Main working method.
             'AudioSystem.write()' is called.
              Internally, it works like this: AudioSystem.write()
             contains a loop that is trying to read from the passed
             AudioInputStream. Since there is a special AudioInputStream
             that gets data from a TargetDataLine, reading from the
             AudioInputStream leads to reading from the TargetDataLine. The
             data read this way is then written to the passed File. Before
             writing of audio data starts, a header is written according
             to the desired audio file type. Reading continues until no
             more data can be read from the AudioInputStream. In this case,
             it happens if no more data can be read from the TargetDataLine.
             This happens if the TargetDataLine is stopped. Then,
             the file is closed and 'AudioSystem.write()' returns.
         public void run()
                   try
                        AudioSystem.write(
                             m_audioInputStream,
                             m_targetType,
                             m_outputFile);
                   catch (IOException e)
                        e.printStackTrace();
         public static void main(String[] args)
              if (args.length != 1 || args[0].equals("-h"))
                   printUsageAndExit();
              /* There is only one command line argument.
                 This is taken as the filename of the soundfile
                 to store to.
              String     strFilename = args[0];
              File     outputFile = new File(strFilename);
              /* For simplicity, the audio data format used for recording
                 is hardcoded here. The PCM 44.1 kHz, 16 bit signed,
                 stereo was used.
              AudioFormat     audioFormat = new AudioFormat(
                   AudioFormat.Encoding.PCM_SIGNED,
                   44100.0F, 16, 2, 4, 44100.0F, false);
              /* Here, the TargetDataLine is being received. The
                 TargetDataLine is used later to read audio data from it.
                 If requesting the line was successful, it will open it.
              DataLine.Info     info = new DataLine.Info(TargetDataLine.class, audioFormat);
              TargetDataLine     targetDataLine = null;
              try
                   targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
                   targetDataLine.open(audioFormat);
              catch (LineUnavailableException e)
                   out("unable to get a recording line");
                   e.printStackTrace();
                   System.exit(1);
              AudioFileFormat.Type     targetType = AudioFileFormat.Type.WAVE;
              /* The creation of the VoicePasswordRecorder object.
                 It contains the logic of starting and stopping the
                 recording, reading audio data from the TargetDataLine
                 and writing the data to a file.
              VoicePasswordRecorder     recorder = new VoicePasswordRecorder(
                   targetDataLine,
                   targetType,
                   outputFile);
              /* It is waiting for the user to press ENTER to
                 start the recording.
              out("Press ENTER to start the recording.\n");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              /* Here, the recording is actually started.
              recorder.start();
              out("Recording...\n");
              /* It is waiting for the user to press ENTER,
                 this time to signal that the recording should be stopped.
              out("Press ENTER to stop the recording.\n");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              /* Here, the recording is actually stopped.
              recorder.stopRecording();
              out("Recording stopped.\n");
         private static void printUsageAndExit()
              out("VoicePasswordRecorder: usage:");
              out("\tjava VoicePasswordRecorder -h");
              out("\tjava VoicePasswordRecorder <audiofile>");
              System.exit(0);
         private static void out(String strMessage)
              System.out.println(strMessage);
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    import javax.sound.sampled.*;
    import javax.swing.*;
    public class AppletTest extends JApplet
        implements ActionListener
        public AppletTest()
            comp = null;
            startrecording = null;
            stoprecording = null;
            recorder = null;
        public void init()
            Panel panel = new Panel(new FlowLayout(1));
            comp = new JTextArea(50, 50);
            comp.setPreferredSize(new Dimension(50, 50));
            comp.setEditable(false);
            JButton startrecording = new JButton("Start");
            JButton stoprecording = new JButton("Stop");
            comp.append("Please record your Voice Password...\n");
            GridBagLayout gridbag = new GridBagLayout();
            GridBagConstraints c = new GridBagConstraints();
            getContentPane().setLayout(gridbag);
            c.weightx = 1.0D;
            c.weighty = 1.0D;
            gridbag.setConstraints(comp, c);
            gridbag.setConstraints(panel, c);
            getContentPane().add(comp, c);
            getContentPane().add(panel, c);
            c.weightx = 0.0D;
            c.weighty = 0.0D;
            startrecording.setEnabled(true);
            stoprecording.setEnabled(true);
            startrecording.addActionListener(this);
            gridbag.setConstraints(startrecording, c);
            getContentPane().add(startrecording, c);
            stoprecording.addActionListener(this);
            gridbag.setConstraints(stoprecording, c);
            getContentPane().add(stoprecording, c);
            int width = 300;
            int height = 200;
            setSize(width, height);
            setVisible(true);
            boolean looping = false;
        public void actionPerformed(ActionEvent ae)
            if(ae.getActionCommand().equals("Start"))
                createRecorder();
                recorder.start();
                System.out.println("Start Button Clicked");
            } else
            if(ae.getActionCommand().equals("Stop"))
                recorder.stopRecording();
                System.out.println("Stop Button Clicked");
        private void createRecorder()
            String strFilename = "C:\test.wav";
            File outputFile = new File(strFilename);
            AudioFormat audioFormat = new AudioFormat(javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED, 44100F, 16, 2, 4, 44100F, false);
            javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax.sound.sampled.TargetDataLine.class, audioFormat);
            TargetDataLine targetDataLine = null;
            try
                targetDataLine = (TargetDataLine)AudioSystem.getLine(info);
                targetDataLine.open(audioFormat);
            catch(LineUnavailableException e)
                comp.append("unable to get a recording line\n");
                e.printStackTrace();
                System.exit(1);
            javax.sound.sampled.AudioFileFormat.Type targetType = javax.sound.sampled.AudioFileFormat.Type.WAVE;
            recorder = new SimpleAudioRecorder(targetDataLine, targetType, outputFile);
            comp.append("Press ENTER to start the recording.\n");
            try
                System.in.read();
            catch(IOException e)
                e.printStackTrace();
            comp.append("Recording...\n");
            comp.append("Press ENTER to stop the recording.\n");
            try
                System.in.read();
            catch(IOException e)
                e.printStackTrace();
            comp.append("Recording stopped.\n");
        private JTextArea comp;
        private JButton startrecording;
        private JButton stoprecording;
        private SimpleAudioRecorder recorder;
    }I intend to use this for verifying the username, password and a voice password over the web....as shown in the following code...
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta http-equiv="Content-Language" content="en-us">
    <title>Home Page</title>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta name="Microsoft Theme" content="artsy 011, default">
    <meta name="Microsoft Border" content="tl, default">
    </head>
    <body background="arttilea.jpg" bgcolor="#000000" text="#FFFFCC" link="#FF9900" vlink="#999900" alink="#669933">
    <!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font size="4" color="#FFFFFF">Please enter login
          details below:</font></p>
    <form>
    <!--mstheme--></font><table border=0 cellpadding=3 cellspacing=3>
    <tr>
        <td align=right width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Username</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><input type=text
          name=username size="20"></p>
        <!--mstheme--></font></td>
    </tr>
    <tr>
        <td align=right width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Password</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left">
            <input
            type=password name=password size="20"></p>
          <!--mstheme--></font></td>
      </tr>
      <tr>
        <td align=center width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Voice
          Password Check</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
           <p align="left">
    <APPLET CODE="AppletTest.class" ALIGN="MIDDLE" WIDTH=272 HEIGHT=38 NAME="AppletTest.class"></APPLET> </p>
        <!--mstheme--></font></td>
      </tr>
    <tr>
        <td colspan=2 align=center><!--mstheme--><font face="Arial, Helvetica">
        <p align="left"><font face="Arial Narrow"><input type=submit value="Enter Website" name="Submit"></font></p>
        <!--mstheme--></font></td>
    </tr>
    </table><!--mstheme--><font face="Arial, Helvetica">
    </form>
          <p align="left">This page was last updated on <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d/%m/%y" startspan -->25/03/04<!--webbot bot="Timestamp" endspan i-checksum="12776" -->.</p>
    <!--mstheme--></font></body>
    </html>I will be very grateful if somebody could help me out....as this is my first time at java programming ....also my first time for using this forum!
    Thanks,
    Regards,
    Mayur Patel

    Hi
    I Learned how to read a file text and Parse as StringTokenizer. But still i don't know how to read the Individual tokens into to database.
    But now i face a new Problem, i am not able to sort it out.
    i am posting my code
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.BufferedReader;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.*;
    import java.util.*;
    public class CSVExample {
        public static void main(String[] args) throws IOException {
            BufferedReader inputStream = null;
            PrintWriter outputStream = null;
            try {
                inputStream = new BufferedReader(new FileReader("file.csv"));
              String text;
                 while((text=inputStream.readLine())!= null)
                    StringTokenizer st = new StringTokenizer(text);
                         if(st.hasMoreTokens())
                        System.out.println(st.nextToken());
            } finally {
                if (inputStream != null) {
                    inputStream.close();
    }Here the Problem is The file.csv has got two fields ID, NAME The content of this file is as follows
    T12,MR.RAJ KUMAR
    T13,MR.EARNEST DIES
    T14,MR.MATHEW HYDEN
    Now when i StringTokenize this File The Output printed as follows
    T12,MR.RAJ
    T13,MR.EARNEST
    T14,MR.MATHEW
    That means when it finds the Space it is not printing the Remaining Text.
    Please Help me in this and then Tell me how to INSER The Tokens into the Database Table
    Thank you for your service
    Cheers
    Jofin

  • How to insert bulk data into ms-access

    Hi,
    I am trying to insert bulk data into ms-access. I used Statement it is
    working fine but not allowing to insert single quote. Then I tryed with
    PreparedStatement which is allowing single quote but not allowing bulk data. The following error i am getting.
    javax.servlet.ServletException: [Microsoft][ODBC Microsoft Access Driver]String data, right truncated (null)
    please help me..
    guru

    have u tried out the memo datatype in access?

  • How can I  delete and update records using where conditions?

    I want to delete and update the coherence records with some conditions, I describe it to use SQL as follows:
    delete from "contacts" where getStreet() = "dsada";
    update contacts set getStreet() = "dddd" where getCity() = "ssss";
    Can I use the filter like query to achieve this requirement as follows:
    ValueExtractor::View vHomeStateExtractor = ChainedExtractor::create(
    ChainedExtractor::createExtractors("getHomeAddress.getState"));
    Object::View voStateName = String::create("MA");
    Set::View setResults = hCache->entrySet(
    EqualsFilter::create(vHomeStateExtractor, voStateName));
    I know I can use get and put to achieve this requirement , but it Requires a two-interaction between the client and coherence server. Does it have And another way?
    Thanks very much, and please Forgive my English is not very good.

    Hi,
    You have a couple of options for updating or deleting using a Filter.
    For deleting you can use an Entry Processor and the cache invokeAll method. Using "out of the box" Coherence you can use the ConditionalRemove entry processor. I'm a Java person so the C++ below might not be exactly right but you should get the idea.
    ValueExtractor::View vHomeStateExtractor = ChainedExtractor::create(
    ChainedExtractor::createExtractors("getHomeAddress.getState"));
    Object::View voStateName = String::create("MA");
    hCache->invokeAll(EqualsFilter::create(vHomeStateExtractor, voStateName),
    ConditionalRemove::create(AlwaysFilter.getInstance());For update you would either need to write custom Entry Processor implementations that perform the updates you require or you can use out of the box POF or Reflection ValueUpdaters that update specific fields of the entries in the cache. These valueUpdaters would be wrapped in an UpdaterProcessor so the call would be very similar to the code above.
    JK

  • Updating record using table contorl

    hi ABAPers,
    i have a problem while updating the record to a database table from table control,
    please,check the code writtern,
    Code in Top include:
    Tables: MARA,
            MAKT.
    DATA: BEGIN OF ITAB OCCURS 0,
          MATNR LIKE MARA-MATNR,
          SPRAS LIKE MAKT-SPRAS,
          MAKTX LIKE MAKT-MAKTX,
          END OF ITAB.
    *data:ok_code(20).
    CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 2000.
    *DATA: cols LIKE LINE OF TC1-cols,
         lines TYPE i.
    Screen_1000:Code in PAI:
    module USER_COMMAND_1000 input.
    CASE SY-UCOMM.
    WHEN 'DISPLAY'.
    SELECT SPRAS MAKTX FROM MAKT INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR = MARA-MATNR.
    IF SY-DBCNT IS INITIAL.
    MESSAGE I127(ZKC_MSGCLS).
    ELSE.
    SET SCREEN 2000.
    ENDIF.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    SET SCREEN 0.
    ENDCASE.
    endmodule.                 " USER_COMMAND_1000  INPUT
    Screen_2000:Code in PBO:
    module ctrl_pai output.
    MOVE-CORRESPONDING ITAB TO MAKT.
    endmodule.                 " ctrl_pai  OUTPUT
    Screen_2000:Code in PAI:
    module USER_COMMAND_2000 input.
    CASE SY-UCOMM.
    WHEN 'UPDATE'.
       LOOP AT TC1-cols INTO cols WHERE index GT 2.
           IF  cols-screen-input = '0'.
             cols-screen-input = '1'.
           ELSEIF  cols-screen-input = '1'.
             cols-screen-input = '0'.
           ENDIF.
           MODIFY TC1-cols FROM cols INDEX sy-tabix.
         ENDLOOP.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    SET SCREEN 0.
    WHEN 'BACK'.
    SET SCREEN 1000.
    ENDCASE.
    endmodule.                 " USER_COMMAND_2000  INPUT
    Screen_2000:Code outside PBO
    LOOP AT itab WITH CONTROL TC1 CURSOR TC1-TOP_LINE.
      MODULE ctrl_pai.
    ENDLOOP.
    Screen_2000:Code outside PAI
    LOOP AT itab.
    ENDLOOP.
    regards,
    vinod

    Hi,
    Go thro' the coding in this link.It will help you.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    Message was edited by:
            Jayanthi Jayaraman

  • Updating records using a view

    Hello,
    I have two tables, ROAD and ROAD_PARSED. I have created a view ROAD_V that contains the fields from ROAD and ROAD_PARSED that I want to to update in ROAD.
    CREATE VIEW ROAD_V AS SELECT A.ID, A.PREF, A.NAME, A.TYPE, A.DIR,  B.PREF "BPREFIX", B.NAME "BNAME",  B.TYPE "BTYPE", B.DIR "BDIR"
    FROM ROAD A, ROAD_PARSED B
    WHERE A.ID=B.ID;
    Then I entered my update statement: UPDATE ROAD_V SET PREF=BPREFIX, NAME=BNAME, TYPE=BTYPE, DIR=BDIR;
    I got this error: +"ORA-01779: cannot modify a column which maps to a non key-preserved table".+ ROAD has a spatial index on ID and ROAD_PARSED has a unique on ID, and there are not other unique fields in my table. How do I go about adding a unique index to ROAD when i have already indexed ID?
    The only thing I can think of to work around it is to create a new field in ROAD, populate it with a sequence starting at 1 and assign a unique index to it, insert those values into ROAD_PARSED, and then run the update. This sounds unnecessary...but is it the right way?

    Hi Beaver,
    You can find examples and explanations regarding your error here:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:548422757486
    and/or
    http://asktom.oracle.com/pls/asktom/asktom.search?p_string=%22ORA-01779%22

  • Queries to retrieve records (using Coldfusion) into arrays

    I have been reading about Coldfusion and Flex/Flash Builder integration, I am quite the beginner here. So far, I was able to follow the examples I found at Adobe's website. Those tutorials show how to bind the query results into forms. What I want to do is to run a query that will return multiple records, and I would like to store those records in an array. In other words I want to access each of the elements of each object by iterating
    Here is an example (I am only putting the relevant part of the code here) of what I could achieve with binding so far
                protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getEmployeeDataByRegionResult.token = salesTarget.getEmployeeDataByRegion(/*Enter value(s) for */ 'Central');
              <s:CallResponder id="getEmployeeDataByRegionResult"/>
        <mx:DataGrid x="477" y="118" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getEmployeeDataByRegionResult.lastResult}">
            <mx:columns>
                <mx:DataGridColumn headerText="PHONE" dataField="PHONE"/>
                <mx:DataGridColumn headerText="FIRSTNAME" dataField="FIRSTNAME"/>
                <mx:DataGridColumn headerText="YTD" dataField="YTD"/>
                <mx:DataGridColumn headerText="Q1GOAL" dataField="Q1GOAL"/>
                <mx:DataGridColumn headerText="EMAIL" dataField="EMAIL"/>
                <mx:DataGridColumn headerText="LASTNAME" dataField="LASTNAME"/>
            </mx:columns>
        </mx:DataGrid>
    So instead of this, I basically want to load the results into an array, so that I can iterate through the records as I want. A mysql query in php type of query is exactly what I am looking for. For example
    $result = mysql_query("SELECT id, name FROM mytable WHERE .... ");
    while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
        printf("ID: %s  Name: %s", $row[0], $row[1]); 
    Thank you

    hi,
    this thread may interest you
    http://forums.adobe.com/message/2834411#2834411
    David.

  • Update records using Pl/Sql procedure

    Hi
    I have wriitten a stored procedure to update the Organisation_Name in a table based on the Full_Org_Nm of an another table.
    Though the procodure got executed sucessfully but it is not updating the records.
    I even tried executing the procedure by writing Execute <Procedure name>,the database got hanged.
    Please find my procedure below.
    Create or Replace
    PROCEDURE UPDT_ISSUE_USR_ROLE
    As
    Cursor cur_user_role Is
    Select a.org_id,a.user_id
    from prts_user a,issue_user_role b
    where a.user_id=b.user_id;
    v_rows_processed Number:=0;
    Begin
    For rec in cur_user_role Loop
    update Issue_user_role
    set User_org_nm=(Select full_org_nm from VW_Org where org_id=rec.org_id)
    Where Issue_User_Role.rowid in
    (select issue_user_role.rowid
    FROM issue_user_role,issue,issue_workflow,Issue_step_dtl_wrkflw
    Where Issue_User_Role.Issue_Id=Issue.Issue_id
    And Issue_User_Role.Issue_id=issue_workflow.issue_id
    And Issue_User_Role.Workflow_compnt_id=Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID
    And Issue_User_Role.Workflow_compnt_id=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
    And Issue_User_Role.Issue_id=Issue_Step_Dtl_wrkflw.Issue_Id
    And Issue.Issue_id=Issue_workflow.Issue_Id
    And Issue.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
    And Issue_workflow.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
    And Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
    And issue_workflow.primry_workflow_flag='Y'
    And issue_user_role.user_id = rec.user_id
    And issue.issue_status_id in (1636,50738,275,50737,2090)
    And issue_step_dtl_wrkflw.Issue_step_status_id in (61248,61249,61250));
    v_rows_processed :=v_rows_processed + SQL%ROWCOUNT;
    End Loop;
    COMMIT;
    dbms_output.enable;
    dbms_output.put_line('There were '||v_rows_processed||' rows updated');
    End;
    Please let me know where i am wrong.
    Thanks in advance.
    Cheers

    Hi Blushadow
    Now if i want to update say only 10 records at a time what should i put into my Proc?
    Please go thru my Proc below..
    CREATE OR REPLACE PROCEDURE PRTS.UPDT_ISSUE_USR_ROLE
    As
    Cursor cur_user_role Is
    Select a.org_id,a.user_id
    from prts_user a,issue_user_role b
    where a.user_id=b.user_id;
    upd_rec cur_user_role%rowtype;
    v_rows_processed Number:=0;
    Begin
    Open cur_user_role;
    Loop
    Fetch cur_user_role into upd_rec;
    If cur_user_role%NOTFOUND
    Then
    Exit;
    Else
    update Issue_user_role
    set User_org_nm=(Select full_org_nm from VW_Org where org_id=upd_rec.org_id)
    Where Issue_User_Role.rowid in
    (select issue_user_role.rowid
    FROM issue_user_role,issue,issue_workflow,Issue_step_dtl_wrkflw
    Where Issue_User_Role.Issue_Id=Issue.Issue_id
    And Issue_User_Role.Issue_id=issue_workflow.issue_id
    And Issue_User_Role.Workflow_compnt_id=Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID
    And Issue_User_Role.Workflow_compnt_id=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
    And Issue_User_Role.Issue_id=Issue_Step_Dtl_wrkflw.Issue_Id
    And Issue.Issue_id=Issue_workflow.Issue_Id
    And Issue.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
    And Issue_workflow.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
    And Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
    And issue_workflow.primry_workflow_flag='Y'
    And issue_user_role.user_id = upd_rec.user_id
    And issue.issue_status_id in (1636,50738,275,50737,2090)
    And issue_step_dtl_wrkflw.Issue_step_status_id in (61248,61249,61250));
    v_rows_processed :=v_rows_processed + SQL%ROWCOUNT;
    If Mod (v_rows_processed,v_rows_processed)=10
    then
    COMMIT;
    End if;END IF;
    End Loop;
    Commit;
    dbms_output.enable(1000000);
    dbms_output.put_line('There were '||v_rows_processed||' rows updated');
    Close cur_user_role;
    End;
    I would appreciate if you can let me know any other alternative way to meet this requirment.
    Cheers
    Vineet

  • Problem inserting record using INSERT INTO

    I am an amateur web builder using some ColdFusion functionality to access information on an Access database. I know very little about ColdFusion syntax, but I'm using Dreamweaver CS3 to help generate most of the code. I'm working on an insert record page to create a user database with login information. I'm not sure what the problem is, but I'm getting a syntax error referencing this particular portion of the code:
    Syntax error in INSERT INTO statement.
    The error occurred in C:\ColdFusion9\wwwroot\Everett\register.cfm: line 22
    Below is the entire page with line 22 (referenced in the error message) in red. Any ideas?
    <cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
    <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "register">
      <cfquery datasource="everettweb">  
        INSERT INTO Users ([First Name], [Last Name], [Email Address], Password)
    VALUES (<cfif IsDefined("FORM.first_name") AND #FORM.first_name# NEQ "">
    <cfqueryparam value="#FORM.first_name#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.last_name") AND #FORM.last_name# NEQ "">
    <cfqueryparam value="#FORM.last_name#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.email") AND #FORM.email# NEQ "">
    <cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.password") AND #FORM.password# NEQ "">
    <cfqueryparam value="#FORM.password#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
      </cfquery>
      <cflocation url="register_success.cfm">
    </cfif>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Main.dwt" codeOutsideHTMLIsLocked="false" -->
    <head>
    <link href="main.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Everett Music Department, Everett, MA</title>
    <!-- InstanceEndEditable -->
    <style type="text/css">
    <!--
    body {
    background-color: #660000;
    -->
    </style>
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    //-->
    </script>
    <!-- InstanceBeginEditable name="head" -->
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
    <!-- InstanceEndEditable -->
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    a:link {
    color: #660000;
    a:visited {
    color: #A01D22;
    a:hover {
    color: #FFCC00;
    -->
    </style>
    <link href="main.css" rel="stylesheet" type="text/css" />
    </head>
    <body onload="MM_preloadImages('menu_about_over','menu_ensembles_over.jpg','menu_schools_over.j pg','menu_events_over.jpg','menu_faculty_over.jpg','menu_contacts_over.jpg','menu_home_ove r.jpg','menu_about_over.jpg','menu_links_over.jpg','menu_login_over.jpg')">
    <table width="960" align="center" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="3"><img src="top_border.jpg" width="960" height="20" align="top" /></td>
      </tr>
      <tr align="center">
        <td colspan="3"><a href="index.php"><img src="e_oval_top.jpg" height="100" width="270" border="0" /></a><a href="index.php"><img src="header.jpg" height="100" width="690" border="0" /></a></td>
      </tr>
      <tr>
        <td height="35" width="301"><a href="index.php"><img src="e_oval_bottom.jpg" height="35" width="234" border="0" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','menu_home_over.jpg',1)"><img src="menu_home.jpg" width="67" height="35" name="home" border="0" id="home" /></a></td>
        <td width="251"><ul id="MenuBar1" class="MenuBarHorizontal">
          <li><a class="MenuBarItemSubmenu" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('about','','menu_about_over.jpg',1)"><img src="menu_about.jpg" width="71" height="35" name="about" border="0" id="about" /></a>
            <ul>
              <li><a href="#">News</a></li>
              <li><a href="#">History</a></li>
              <li><a href="#">Media</a></li>
            </ul>
          </li>
          <li><a class="MenuBarHorizontal" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('ensembles','','menu_ensembles_over.jpg',1)"><img src="menu_ensembles.jpg" width="98" height="35" name="ensembles" border="0" id="ensembles" /></a>
            <ul>
              <li><a href="#">Band</a></li>
              <li><a href="#">Chorus</a></li>
              <li><a href="#">Strings</a></li>
            </ul>
          </li>
          <li><a class="MenuBarItemSubmenu" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('schools','','menu_schools_over.jpg',1)"><img src="menu_schools.jpg" width="82" height="35" name="schools" border="0" id="schools" /></a>
            <ul>
              <li><a href="#">Everett High School</a></li>
              <li><a href="#">English School</a></li>
              <li><a href="#">Keverian School</a></li>
              <li><a href="#">Lafayette School</a></li>
              <li><a href="#">Parlin School</a></li>
              <li><a href="#">Webster School</a></li>
              <li><a href="#">Whittier School</a></li>
            </ul>
          </li>
        </ul>
        </td>
               <td width="408"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('events','','menu_events_over.jpg',1)"><img src="menu_events.jpg" width="74" height="35" name="events" border="0" id="events" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('faculty','','menu_faculty_over.jpg',1)"><img src="menu_faculty.jpg" width="79" height="35" name="faculty" border="0" id="faculty" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('links','','menu_links_over.jpg',1)"><img src="menu_links.jpg" width="66" height="35" name="links" border="0" id="links" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('login','','menu_login_over.jpg',1)"><img src="menu_login.jpg" name="login" width="69" height="35" border="0" id="login" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact','','menu_contact_over.jpg',1)"><img src="menu_contact.jpg" width="100" height="35" name="contact" border="0" id="contact" /></a><img src="menu_spacer_end.jpg" width="20" height="35" /></td>
      </tr>
      <tr height="10">
        <td colspan="3"><img src="menu_bottom_spacer.jpg" height="10" width="960" /></td>
      </tr>
    </table>
    <table width="960" cellpadding="0" cellspacing="0" align="center">
      <tr height="50">
        <td width="30" background="left_border.jpg"><img src="clear.gif" width="30" height="50" /></td>
        <td width="900" bgcolor="#FFFFFF">
          <table width="900" cellpadding="0" cellspacing="0">
            <tr>
              <td width="900" height="350" valign="top"><!-- InstanceBeginEditable name="PageBody" -->
          <form action="<cfoutput>#CurrentPage#</cfoutput>" method="POST" name="register" preloader="no" id="register">
                <table width="100%">
                  <tr>
                    <td colspan="2" class="heading1">Fill in the information below to register for this site:</td>
                  </tr>
                  <tr>
                    <td colspan="2"><img src="clear.gif" height="15" /></td>
                  </tr>
                  <tr>
                    <td width="50%" class="form" align="right">First Name:</td>
                    <td width="50%"><span id="sprytextfield1">
                      <input type="text" name="first_name" required="yes" id="first_name" width="150" typeahead="no" showautosuggestloadingicon="true" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Last Name:</td>
                    <td><span id="sprytextfield2">
                      <input type="text" name="last_name" required="yes" id="last_name" width="150" typeahead="no" showautosuggestloadingicon="true" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Email Address:</td>
                    <td><span id="sprytextfield3">
                    <input type="text" name="email" validate="email" required="yes" id="email" width="150" typeahead="no" showautosuggestloadingicon="true" />
                    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Confirm Email Address:</td>
                    <td><span id="sprytextfield4"><span id="ConfirmWidget">
                    <input type="text" name="email_confirm" validate="email" required="yes" id="email_confirm" width="150" typeahead="no" showautosuggestloadingicon="true" />
                    <span class="confirmInvalidMsg">The values do not match</span></span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Password:</td>
                    <td><span id="sprytextfield5">
                      <input type="password" name="password" required="yes" id="password" width="150" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Confirm Password:</td>
                    <td><span id="sprytextfield6"><span id="ConfirmWidget">
                      <input type="password" name="password_confirm" required="yes" id="password_confirm" width="150" />
                      <span class="confirmInvalidMsg">The values do not match</span></span></span></td>
                  </tr>
                  <tr>
                    <td> </td>
                    <td><input name="submit" type="submit" id="submit" value="Register" /></td>
                  </tr>
                </table>
          <input type="hidden" name="MM_InsertRecord" value="register" />
          </form>
          <script type="text/javascript">
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "email");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "email");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
    var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
    //-->
    </script>
    <script type="text/javascript">
    var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("sprytextfield4", "email");
    var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("sprytextfield6", "password");
    </script>
              <!-- InstanceEndEditable --></td>
            </tr>
          </table>
        </td>
        <td width="30" background="right_border.jpg"><img src="clear.gif" width="30" height="50" /></td>
      </tr>
      <tr>
        <td colspan="3" background="footer.jpg" class="footer" height="80"/>This website best viewed using:<br /><a href="http://www.firefox.com"><img src="firefox_logo.gif" width="110" height="40" border="0" /></a></td>
      </tr>
    </table>
    <script type="text/javascript">
    <!--
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
    //-->
    </script>
    </body>
    <!-- InstanceEnd --></html>

    Syntax error in INSERT INTO statement.  INSERT INTO Users ([First Name], [Last Name], [Email Address], Password)
    That oh-so-uninformative error is because "Password" is a reserved word with your database driver.  Either escape it by putting square brackets around it too, or rename the column permanently. It is best to avoid using reserved words whenever possible. So renaming the column is the better option.  Also, I would try and avoid using invalid characters like spaces in column names ie "First Name". It is technically allowed, but it requires special handling everywhere which adds unecessary complexity.
    I'm not sure what the problem is, but I'm getting a syntax error referencing this particular portion of the code:
    Do not take the error line numbers as gospel. Sometimes they just indicate that the error is within the vincinty of that line.
    I'm using Dreamweaver CS3 to help generate most of the code
    Unforutnately, DW wizards generate some truly awful and verbose code.  To give you an idea, here is what the query should look like, without all the wizard nonsense.
      <cfparam name="FORM.first_name" default="">
      <cfparam name="FORM.last_name" default="">
      <cfparam name="FORM.email" default="">
      <cfparam name="FORM.FORM.password" default="">
      <cfquery datasource="YourDSNName"> 
        INSERT INTO Users ([First Name], [Last Name], [Email Address], [Password])
        VALUES (
          <cfqueryparam value="#FORM.first_name#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.last_name#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.password#" cfsqltype="cf_sql_varchar">
      </cfquery>
    CF is pretty easy to learn. You might want to begin perusing the CF documentation and a few tutorials to get more familiar with the language. Since you are working with a database, I would also recommend a  SQL tutorial.

  • UPDATE records using Database Conectivity toolset

    I´m using LabVIEW 8.5 & Database Connectivity toolset ver 1
    When I try to update a record of a MS ACCESS 2003 with the SQL UPDATE TablenName SET field1=newvalue, field2=newvalue........WHERE condition=x, I get the error -2147217900 Exception occurred in Microsoft Jet DataBase engine: Sintax error in the instruction UPDATE.vi ComExec (8.5 bug Workaround)vi.
    I ´dont think I have made a sintax error. If the field is an string I use the 'newvalue' following by a comma, in case of numeric field just the coma. For instance :
    UPDATE TableName SET Name='John', Age=22,Hair='blond' WHERE height=1.85
    I have discarded the reserved word´s problem, as I can insert records in the data base without any problem 
    Any idea to solve the problem
    Thanks
    Simbani

    Did you try it like this?
    UPDATE TableName SET TableName.Name='John', TableName.Age=22,TableName.Hair='blond' WHERE TableName.height=1.85

  • Updating records using self join or row number function

    IF OBJECT_ID('tempdb..#Temp') IS NOT NULL DROP TABLE #Temp
    GO
    CREATE TABLE #Temp
    ID INT
    , CYear INT
    , Val INT
    , Descrp Varchar(10) NULL
    , Cd INT
    , ToBeUpdated Varchar(5) NULL
    INSERT INTO #Temp
    ID
    , CYear
    , Val
    , Descrp
    , Cd
    , ToBeUpdated
    SELECT 2014, 2013, 111, 'ABC', 2, NULL
    UNION
    SELECT 2014, 2014, 111, 'XYZ', 2, NULL
    UNION
    SELECT 2014, 2014, 222, 'TTT', 3, NULL
    UNION
    SELECT 2014, 2013, 333, 'ZZZ', 4, NULL
    UNION
    SELECT 2014, 2014, 333, 'VVV', 5, NULL
    SELECT * FROM #Temp
    ORDER BY Val, CYear
    All, I have the above #table. You'll notice that there are duplicate values in "Cd" column i.e. "Cd=2".
    If the values in ID, Val and Cd are same then, I want to update the "CodeFlag" column for those records with "Descrp" column of
    the recent CYear. So, my "ToBeUpdated" column would have a value of "XYZ" for both the records where Cd=2 (Since, XYZ is the Descrp for CYear 2014(the latest one))
    Also, if the values in ID and Val column are same but values in "Cd" is different, then ToBeUpdated = Descrp of that particular record. In my case the "ToBeUpdated" value for Cd=4 would be "ZZZ" and for Cd=5, it would be "VVV"
    since the ID and Val column values are same for those records. Let me know if you have any questions.

    IF OBJECT_ID('tempdb..#Temp') IS NOT NULL DROP TABLE #Temp
    GO
    CREATE TABLE #Temp
    ID INT , CYear INT , Val INT , Descrp Varchar(10) NULL , Cd INT , ToBeUpdated Varchar(5) NULL)
    INSERT INTO #Temp
    ID , CYear , Val , Descrp , Cd , ToBeUpdated)
    SELECT 2014, 2013, 111, 'ABC', 2, NULL
    UNION
    SELECT 2014, 2014, 111, 'XYZ', 2, NULL
    UNION
    SELECT 2014, 2014, 222, 'TTT', 3, NULL
    UNION
    SELECT 2014, 2013, 333, 'ZZZ', 4, NULL
    UNION
    SELECT 2014, 2014, 333, 'VVV', 5, NULL
    ;with mycte as (SELECT *, row_number() Over(partition By ID, Val , Cd order by CYear DESC) rn
    , row_number() Over(partition By ID, Val order by Descrp) rn1
    FROM #Temp)
    SELECT m1.ID ,m1.CYear,m1.Val,m1.Descrp , ToBeUpdated=d.descrp from mycte m1
    Cross apply (Select Top 1 descrp from mycte m2 WHERE m2.id=m1.ID AND m1.Val=M2.Val AND m1.cd=m2.cd AND m1.rn>=m2.rn) d(descrp)

  • How do I use the INTO word in my querys?

    Hi! I'm working with Oracle 10g and Microsoft Visual Studio 2008 (Visual C#), I connected both succesfully, now I can add data to my tables from C#, but the problem comes when I try to request data from the database, I'm trying to do that with this query: "SELECT Id_Estado, DetalleEstado FROM Estado", but it doesn't work, it shows me an error, saying that I have to put an "INTO" in my query, but, where should I put it? and in wich kind of "object" should I save the data that I'm requesting.
    I guess I have to make a query like this: "SELECT Id_Estado, DetalleEstado INTO "an object/container" FROM Estado".
    I'm new with Oracle, I hope you can help me. Thank you so much.

    I would suggest you this
    1. Create a stored function with return typer as REF CURSOR. You can create your own REF CURSOR or use the oracle supplied one i.e. SYS_REFCURSOR.
    2. Inside the function do something like this.
    create or replace function get_estado_data return sys_refcursor
    as
      pOutCursor sys_refcursor;
    begin
      open pOutCursor for
      select * from Estado;
      return pOutCursor;
    end;
    /3. Now from your C# call this function using ExicuteDataSet API and store the output in a DataSet.

Maybe you are looking for

  • HP OfficeJet gx85i and HP Laserjet 1200

    I have a friend of mine who just bought a mac mini to be a file/print/backup server for his home network. He has three printers plugged into the mini, an hp officejet gx85i, and hp laserjet 1200, and an hp photosmart printer. Both the laserjet and th

  • Logon for ABAP WebDynpro Application

    Hi All, To run an ABAP webdynpro application, do the users need sepearate login for R/3 and SAP WAS, for which SSO can be configured. or is it just one login required? Thanks Hardik

  • HT Receive Connectors and certificates

    What are the default certificates that should be installed on Exchange 2010 HT role (and show up in EMC)? How do I reset the certs and start fresh (or at least check if there are conflicts or invalid certs)? My Exchange Connectivity Analyzer test suc

  • CSS a:link not working in browser

    Hello all, Every time I have tied to add the a:link pseudo class to a page, it affects the links in design view correctly (according to the style I've applied to the a:link) but it never shows up when I preview in Firefox or IE. This happens regardle

  • Can I sort my applications in Launchpad?

    Launchpad has chosen to sort my applications in some weird arbitrary order.  Is there any way to tell it to sort them alphabetically?