SQL Update Query not Working...

  This was working until we had to encrypt the main key.  This has been replaced with an existing autonum field.  When I test the T-SQL query alone on SQL Server,  it works.   But through the ColdFusion progam, nothing happens.  Its as if the submit button reference to this is not working or is ignored.
Any ideas?
Here is the code clip were the issue may be occuring.
<cfparam name="URL.SEQNO" default="1">
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfif IsDefined("FORM.MM_UpdateRecord") AND FORM.MM_UpdateRecord EQ "formUpdateRecord">
  <cfquery name="Section301MI" datasource="301dsn">
  DECLARE @str NVARCHAR(128)
  SET @str = #FORM.SSN#;
  OPEN SYMMETRIC KEY SSN_Key_01
   DECRYPTION BY CERTIFICATE anjalitest
  UPDATE dbo.TableDataRecords SET SSN=
  <cfif IsDefined("FORM.SSN") AND #FORM.SSN# NEQ "">
    EncryptByKey(Key_GUID('SSN_Key_01'),@str)
      <cfelse>
      NULL
  </cfif>
  , verifySSN =
  <cfif IsDefined("FORM.SSN") AND #FORM.SSN# NEQ "">
    EncryptByKey(Key_GUID('SSN_Key_01'),@str)
      <cfelse>
      NULL
  </cfif>
  , LastName=
  <cfif IsDefined("FORM.LastName") AND #FORM.LastName# NEQ "">
    '#FORM.LastName#'
      <cfelse>
      NULL
  </cfif>
  , FirstName=
  <cfif IsDefined("FORM.FirstName") AND #FORM.FirstName# NEQ "">
    '#FORM.FirstName#'
      <cfelse>
      NULL
  </cfif>
  , MiddleInitial=
  <cfif IsDefined("FORM.MiddleInitial") AND #FORM.MiddleInitial# NEQ "">
    '#FORM.MiddleInitial#'
      <cfelse>
      NULL
  </cfif>
  , DOB=
  <cfif IsDefined("FORM.DOB") AND #FORM.DOB# NEQ "">
    '#FORM.DOB#'
      <cfelse>
      NULL
  </cfif>
  , BenefitProgram=
  <cfif IsDefined("FORM.BenefitProgram") AND #FORM.BenefitProgram# NEQ "">
    #FORM.BenefitProgram#
      <cfelse>
      NULL
  </cfif>
  , MedCessDate=
  <cfif IsDefined("FORM.MedCessDate") AND #FORM.MedCessDate# NEQ "">
    '#FORM.MedCessDate#'
      <cfelse>
      NULL
  </cfif>
  , ProgramDecision=
  <cfif IsDefined("FORM.ProgramDecision") AND #FORM.ProgramDecision# NEQ "">
    #FORM.ProgramDecision#
      <cfelse>
      NULL
  </cfif>
  , ProgramDecisionDate=
  <cfif IsDefined("FORM.ProgramDecisionDate") AND #FORM.ProgramDecisionDate# NEQ "">
    '#FORM.ProgramDecisionDate#'
      <cfelse>
      NULL
  </cfif>
  , ProgramType=
  <cfif IsDefined("FORM.ProgramType") AND #FORM.ProgramType# NEQ "">
    #FORM.ProgramType#
      <cfelse>
      NULL
  </cfif>
  , ProgAllowStartDate=
  <cfif IsDefined("FORM.ProgAllowStartDate") AND #FORM.ProgAllowStartDate# NEQ "">
    '#FORM.ProgAllowStartDate#'
      <cfelse>
      NULL
  </cfif>
  , ProgAllowCompDate=
  <cfif IsDefined("FORM.ProgAllowCompDate") AND #FORM.ProgAllowCompDate# NEQ "">
    '#FORM.ProgAllowCompDate#'
      <cfelse>
      NULL
  </cfif>
  , DiaryDate=
  <cfif IsDefined("FORM.DiaryDate") AND #FORM.DiaryDate# NEQ "">
    '#FORM.DiaryDate#'
      <cfelse>
      NULL
  </cfif>
  , DenialReason=
  <cfif IsDefined("FORM.DenialReason") AND #FORM.DenialReason# NEQ "">
    #FORM.DenialReason#
      <cfelse>
      NULL
  </cfif>
  , TermDecisionDate=
  <cfif IsDefined("FORM.TermDecisionDate") AND #FORM.TermDecisionDate# NEQ "">
    '#FORM.TermDecisionDate#'
      <cfelse>
      NULL
  </cfif>
  , TermReason=
  <cfif IsDefined("FORM.TermReason") AND #FORM.TermReason# NEQ "">
    #FORM.TermReason#
      <cfelse>
      NULL
  </cfif>
  , Remarks=
  <cfif IsDefined("FORM.Remarks") AND #FORM.Remarks# NEQ "">
    '#FORM.Remarks#'
      <cfelse>
      NULL
  </cfif>
  , EncryptNatIDNum1 = NULL
  , EncryptNatIDNum2 = NULL
  WHERE SEQNO=#URL.SEQNO#
   CLOSE SYMMETRIC KEY SSN_Key_01;
  </cfquery>
  <cflocation url="modifysuccess.cfm">
</cfif>

1) This is almost a clone to the Insert form that works.  The main differences are It selects the matching record for editing and then Updates.
2) The CFDUMP gives me results when I put it in the logic section that responds to the Form Submit button.  But not at the top of the code.
  I added the CFABORT so I could see a result.
<cfif (IsDefined("FORM.MM_UpdateRecord") AND FORM.MM_UpdateRecord EQ "formUpdateRecord") OR (IsDefined("FORM.UpdateRecord") AND FORM.UpdateRecord EQ "Update Record")>
   <cfdump var="#form#">
  <cfquery name="Section301MI" datasource="301dsn" username="section301db" password="testdb">
  DECLARE @str NVARCHAR(128)
  <cfif IsDefined("FORM.SSN")>
   SET @str = #FORM.SSN#;
  </cfif>
  OPEN SYMMETRIC KEY SSN_Key_01
   DECRYPTION BY CERTIFICATE anjalitest
  UPDATE dbo.TableDataRecords SET verifySSN=                     <<This is only displayed, but not modified.  Should this even be in the update?
  <cfif IsDefined("FORM.SSN") AND #FORM.SSN# NEQ "">
    EncryptByKey(Key_GUID('SSN_Key_01'),@str)
      <cfelse>
      NULL
  </cfif>
  , [LastName]=
  <cfif IsDefined("FORM.LastName") AND #FORM.LastName# NEQ "">
    '#FORM.LastName#'
      <cfelse>
      NULL
  </cfif>
  , [FirstName]=
  <cfif IsDefined("FORM.FirstName") AND #FORM.FirstName# NEQ "">
    '#FORM.FirstName#'
      <cfelse>
      NULL
  </cfif>
  , MiddleInitial=
  <cfif IsDefined("FORM.MiddleInitial") AND #FORM.MiddleInitial# NEQ "">
    '#FORM.MiddleInitial#'
      <cfelse>
      NULL
  </cfif>
  , DOB=
  <cfif IsDefined("FORM.DOB") AND #FORM.DOB# NEQ "">
    '#FORM.DOB#'
      <cfelse>
      NULL
  </cfif>
  , BenefitProgram=
  <cfif IsDefined("FORM.BenefitProgram") AND #FORM.BenefitProgram# NEQ "">
    #FORM.BenefitProgram#
      <cfelse>
      NULL
  </cfif>
  , MedCessDate=
  <cfif IsDefined("FORM.MedCessDate") AND #FORM.MedCessDate# NEQ "">
    '#FORM.MedCessDate#'
      <cfelse>
      NULL
  </cfif>
  , ProgramDecision=
  <cfif IsDefined("FORM.ProgramDecision") AND #FORM.ProgramDecision# NEQ "">
    #FORM.ProgramDecision#
      <cfelse>
      NULL
  </cfif>
  , ProgramDecisionDate=
  <cfif IsDefined("FORM.ProgramDecisionDate") AND #FORM.ProgramDecisionDate# NEQ "">
    '#FORM.ProgramDecisionDate#'
      <cfelse>
      NULL
  </cfif>
  , ProgramType=
  <cfif IsDefined("FORM.ProgramType") AND #FORM.ProgramType# NEQ "">
    #FORM.ProgramType#
      <cfelse>
      NULL
  </cfif>
  , ProgAllowStartDate=
  <cfif IsDefined("FORM.ProgAllowStartDate") AND #FORM.ProgAllowStartDate# NEQ "">
    '#FORM.ProgAllowStartDate#'
      <cfelse>
      NULL
  </cfif>
  , ProgAllowCompDate=
  <cfif IsDefined("FORM.ProgAllowCompDate") AND #FORM.ProgAllowCompDate# NEQ "">
    '#FORM.ProgAllowCompDate#'
      <cfelse>
      NULL
  </cfif>
  , DiaryDate=
  <cfif IsDefined("FORM.DiaryDate") AND #FORM.DiaryDate# NEQ "">
    '#FORM.DiaryDate#'
      <cfelse>
      NULL
  </cfif>
  , DenialReason=
  <cfif IsDefined("FORM.DenialReason") AND #FORM.DenialReason# NEQ "">
    #FORM.DenialReason#
      <cfelse>
      NULL
  </cfif>
  , TermDecisionDate=
  <cfif IsDefined("FORM.TermDecisionDate") AND #FORM.TermDecisionDate# NEQ "">
    '#FORM.TermDecisionDate#'
      <cfelse>
      NULL
  </cfif>
  , TermReason=
  <cfif IsDefined("FORM.TermReason") AND #FORM.TermReason# NEQ "">
    #FORM.TermReason#
      <cfelse>
      NULL
  </cfif>
  , Remarks=
  <cfif IsDefined("FORM.Remarks") AND #FORM.Remarks# NEQ "">
    '#FORM.Remarks#'
      <cfelse>
      NULL
  </cfif>
  , EncryptNatIDNum1 = NULL
  , EncryptNatIDNum2 = NULL
  WHERE SEQNO=#URL.SEQNO#
   CLOSE SYMMETRIC KEY SSN_Key_01;
  </cfquery>
<cfabort>
  <cflocation url="modifysuccess.cfm">
</cfif>

Similar Messages

  • In Oracle this SQL update tatement not working but in MS SQL it works

    Dear Friends,
    The following sql update statement work fine in MS sql server but not working in Oracle. Can you kindly suggest, What is wrong with this statement ? and is their any other way of achieving the same in Oracle.
    UPDATE INPUTSTREET SET EDIT_FLAGS=S.EDIT_FLAGS From INPUTSTREET G, INPUT_SEGBASE S Where G.GEOKEY=S.GEOKEY
    This statement give error in Oralce saying - Statement not ended properly
    Cheers,
    Vinay

    You would normally write
    UPDATE inputStreet g
       SET edit_flags = (SELECT s.edit_flags
                           FROM input_segbase s
                          WHERE s.geokey = g.geokey)If you don't want to update all the rows in inputStreet, you can add a WHERE EXISTS clause.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Update query not working in the JDBC sender Communication channel

    Hi,
    We are working on JDBC to File scenario. As per the configuration, XI should pick the data from SQL database every 20 secs and should update the corresponding flag. We are using subquery in the select and update statement as both header and detail tables are involved.
    Now the issue is, select query is working fine but update statement is not working as expected. It is somehow updating some other records rather than doing for the ones selected by the adapter.
    Moreover logSQLstatement is also not working. Hence we are unable to identify the records which are getting updated.
    Please advise.

    Hi Rumi,
    See Question 8. Transaction Handling (Sender) in [SAP Note 831162 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 JDBC Adapter|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=831162].
    8.  Transaction Handling (Sender)
    Q: If I have the following configured in a JDBC Sender:
    Select Query:
    SELECT column FROM TABLENAME WHERE FLAG = "TRUE"
    Update Query:
    UPDATE TABLENAME SET FLAG = "FALSE" WHERE FLAG = "TRUE"
    How do I know that the JDBC adapter will not update newly added rows (rows that were
    added between the time that the SELECT and UPDATE queries were executed) that were
    not read in the initial SELECT query?
    A: The SELECT and the UPDATE are run in the same DB transaction, i.e. both statements
    have the same view on the database.
    Make sure that both statements use the same WHERE clause. An additional
    requirement for the correct operation of this scenario is the configuration of
    an appropriate transaction isolation level on the database
    (i.e., repeatable_read or serializable). You might also consider using a
    "SELECT FOR UPDATE" statement instead of a plain SELECT statement to
    ensure proper locking on the database. "SELECT FOR UPDATE"
    is not supported in MS SQL database. In this case please make use of an
    appropriate transaction isolation level on the database. For more details
    please contact your DB vendors.
    After, see Transaction Handling Issues in [SAP Note 1039779 - JDBC Adapter issues(Escape character,Transaction handling)|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1039779].
    Best Regards.
    Pedro Baroni

  • SQL UPDATE does not work

    Hey Guys,
    I have an update sql query which does not work with PreparedStatement object. Heres the code snippet:
    PreparedStatement pstmt;
    int numUpd;
    pstmt = con.prepareStatement(
    "UPDATE item_articles SET dataFile=? WHERE itemID=?");
    con.setAutoCommit(false);
    pstmt.setBinaryStream(1,fis,(int)file.length());
    pstmt.setInt(2,item.id);
    numUpd = pstmt.executeUpdate();
    con.commit();
    What I am doing here is that setBinaryStream(...) will upload a file into the DB. The query executes, theres no exception thrown, but my table shows empty field for the file. Note, there are no exceptions thrown from this query.
    If I do the same thing for an INSERT statement, it works. The file gets into the DB. So , the file is there on disk, and theres no problem with it. Just that it does not work with UPDATE.....any clues ???
    thanks
    Askar

    I think UPDATE commands dont work well with blobs.
    I use to select the register with a ResultSet, then get a BLOB Object from the column.
    So you can use a OutputStream to Upload your data.

  • Update query not working from edit page

    Next incident with the guestbook saga:
    Successful execution of gb_entry_mstr_det_e.cfm with URL:
    http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=14 all have database current info...this is good, but:
    textboxes
    Problem 1:
    the SELECT field does not does not reflect/display the correct option I know exists in the database
    the database field whence this SELECT object is supposed to display is a number, not text.
    now,...
    Problem 2:
    Clicked on "Update Your Entry" button at bottom of edit page (to update by going to gb_confirm_update.cfm)
    <INPUT
    TYPE="submit"
    NAME="submit"
    VALUE="Update Your Entry">
    then, arriving at the gb_confirm_update.cfm page, ...
    Got an error (below) executing the page: gb_confirm_update.cfm with resulting URL:
    http://www.benoitsystems.com/ww/bd/gb/gb_confirm_update.cfm?call_number=#gb_entryID#
    --- snippet from template gb_confirm_update.cfm
    <CFQUERY DATASOURCE="9130.ww" NAME="ww_gb_ud">
    UPDATE gb_entries
    SET
    gb_entry_stts_='form.gb_entry_stts_',
    gb_entry_nm_f='form.gb_entry_nm_f',
    gb_entry_nm_l='form.gb_entry_nm_l',
    gb_entry_nm_l_dspl_x=form.gb_entry_nm_l_dspl_x,
    gb_entry_tce='form.gb_entry_tce',
    gb_entry_tce_dspl_x=form.gb_entry_tce_dspl_x,
    gb_entry_cy='form.gb_entry_cy',
    gb_entry_stt='form.gb_entry_stt',
    gb_entry_instr='form.gb_entry_instr',
    gb_entry_m='form.gb_entry_m',
    gb_entry_del_x=form.gb_entry_del_x
    WHERE gb_entryID=form.gb_entryID
    </CFQUERY>
    --- end snippet ---
    =================================================
    Error Executing Database Query. 
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4. 
    The error occurred in E:\benoitsystems.com\wwwroot\ww\bd\gb\gb_confirm_update.cfm: line 2
    1 : <!--- <CFUPDATE DATASOURCE="9130.ww" TABLENAME="gb_entries"> --->
    2 : <CFQUERY DATASOURCE="9130.ww" NAME="ww_gb_ud">
    3 : UPDATE gb_entries
    4 : SET
    SQL    UPDATE gb_entries SET gb_entry_stts_='form.gb_entry_stts_', gb_entry_nm_f='form.gb_entry_nm_f', gb_entry_nm_l='form.gb_entry_nm_l', gb_entry_nm_l_dspl_x=form.gb_entry_nm_l_dspl_x, gb_entry_tce='form.gb_entry_tce', gb_entry_tce_dspl_x=form.gb_entry_tce_dspl_x, gb_entry_cy='form.gb_entry_cy', gb_entry_stt='form.gb_entry_stt', gb_entry_instr='form.gb_entry_instr', gb_entry_m='form.gb_entry_m', gb_entry_del_x=form.gb_entry_del_x WHERE gb_entryID=form.gb_entryID 
    DATASOURCE   9130.ww
    VENDORERRORCODE   -3010
    SQLSTATE   07002
    Please try the following:
    Check the ColdFusion documentation to verify that you are using the correct syntax.
    Search the Knowledge Base to find a solution to your problem.
    Browser   Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
    Remote Address   71.233.234.226
    Referrer   http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=14
    Date/Time   21-Jul-10 03:11 PM
    =================================================
    I have every NAME of each object matching, verbatum, in the UPDATE query, and every database field name correct in teh query also.

    I was encouraged to send snippets in an another submission, and now I believe it is best that I  "lay my cards on the table"
    Here's my hand:
    Pages in question for your review:
    http://www.benoitsystems.com/ww/bd/gb/gb_mstr.cfm  click on the pencil (the toilet will delete the record.
    http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=21  go to bottom of webpage and click “Update Your Entry”
    http://www.benoitsystems.com/ww/bd/gb/gb_confirm_update.cfm?call_number=#gb_entryID#
    In your review of the above (should you choose) before clicking on the pencil, look at the status on the master listing record you will be editing, and feel free to edit.  Most statuses will be “Hold”
    Two dummy MS Access database tables:
    Table 1: "gb_entries" (Guestbook)
    field 1: gb_entries_ID (Autonumber - Long Integer)
    field 2: gb_entries_dt (date/time)
    field 3: gb_entries_nm_f (Text)
    field 4: gb_entries_nm_l (Text)
    field 5: gb_entries_nm_stts_ (Number field - Byte (not bit)) (fed by gb_sttsID)
    couple other text fields
    field 6: gb_entries_em (Text)
    field 7: gb_entries_cy (Text)
    field 8: gb_entries_stt (Text)
    field 9: gb_entries_nm_l_dspl (Yes/No or True/False)
    field 10: gb_entries_m (Memo type)
    Table 2: "gb_stts_rf" (Guestbook Status Reference)
    field 1: gb_sttsID (Autonumber - Long Integer)
    field 2: gb_stts (Text)
    Two Templates:
    This is the edit page (where a person with administrative access may edit the status or change the spelling for someone, etc.):
    <!--- This query fills the form with the chosen record data (except for the darned SELECT object) ---> <CFQUERY NAME="edit_entry" DATASOURCE="9130.ww"> SELECT * FROM gb_entries WHERE #call_number#=gb_entryID </CFQUERY>
    <!--- This query is for the select dropdown of guestbook status options (set to default on “Hold” from gb_nw.cfm) ---> <CFQUERY NAME="q_stts" DATASOURCE="9130.ww"> SELECT * FROM gb_stts_rf </CFQUERY>
    <HTML>
    <HEAD>
    <TITLE>Woodwindology Guestbook Entry Edit Page</TITLE> <CFOUTPUT QUERY="incl_css_bd">#incl_code#</CFOUTPUT>
    </HEAD>
    <BODY
          BGPROPERTIES="fixed">
    <DIV ALIGN="center">
    <IMG
          SRC="<CFOUTPUT>#baseurl#</CFOUTPUT>md/img/ut/ttl/pg/guestbook.gif"
          BORDER="0">
    <BR>
    <IMG
          SRC="<CFOUTPUT>#baseurl#</CFOUTPUT>md/img/ut/ttl/sub/edit_entry.gif"
          BORDER="0">
    <BR>
    Developer View
    </DIV>
    <TABLE>
          <TR>
                <TD>
                      <TABLE
                            WIDTH="100%"
                            BORDER="0"
                            CELLPADDING="5"
                            CELLSPACING="0">
          <TR>
                <TD VALIGN="top">
                      <FORM
                            NAME="f_gb_entry_mstr"
                            ACTION="gb_confirm_update.cfm?call_number=#gb_entryID#"
                            METHOD="post">
                      <CFOUTPUT QUERY="edit_entry">
                      <B>Entry ID:</B>
                      #gb_entryID#     
                      <INPUT
                            TYPE="hidden"
                            NAME="gb_entryID"
                            VALUE="#gb_entryID#">
                      <P>
                      <B>Entry Date and Time:</B>
                      #DateFormat("#gb_entry_dt#","mmmm d, yyyy")# #TimeFormat("#gb_entry_dt#","h:mm tt")#
    <P>
                      <B>Entry Status:</B>
                      <SELECT
                            NAME="gb_entry_stts_"
                            VALUE="#gb_entry_stts_#">
    </CFOUTPUT>
                            <CFOUTPUT QUERY="q_stts">
                                  <OPTION VALUE="#gb_sttsID#">#gb_stts#</OPTION>
                            </CFOUTPUT>
                      </SELECT>
                      <P>
    <CFOUTPUT QUERY="edit_entry">
                      <B>Guest's First Name:</B>
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_nm_f"
                            VALUE="#gb_entry_nm_f#">
                      <P>
                      <B>Guest's Last Name:</B>
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_nm_l"
                            VALUE="#gb_entry_nm_l#">
                      <BR>
                      Display Last Name:
                      <INPUT
                            TYPE="radio"
                            NAME="gb_entry_nm_l_dspl_x"
                            VALUE="Yes">
                      Do Not Display Last Name:
                      <INPUT
                            TYPE="radio"
                            NAME="gb_entry_nm_l_dspl_x"
                            VALUE="no">
                            <P>
                            <B>Your Email Address:</B><BR>
                            <INPUT
                                  TYPE="text"
                                  NAME="gb_entry_tce"
                                  VALUE="#gb_entry_tce#"
                                  SIZE="40"
                                  MAXLENGTH="40">
                      <BR>
                      Uncheck the box to keep email private:
                      <INPUT
                            TYPE="checkbox"
                            NAME="gb_entry_tce_dspl_x"
                            VALUE="#gb_entry_tce_dspl_x#">
                      <P>
                      <SPAN CLASS="emph01">*</SPAN> Your City:
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_cy"
                            VALUE="#gb_entry_cy#"
                            SIZE="30">
                      <P>
                      <SPAN CLASS="emph01">*</SPAN> Your State:
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_stt"
                            VALUE="#gb_entry_stt#"
                            SIZE="30">
                      <BR>
                            <B>Instruments Played:</B>
                      <BR>
                            <TEXTAREA
                                  COLS="45"
                                  MAX="50"

  • Switch from MySQL to MS SQL Server, Query not working

    I'm sure there is a simple setting somewhere for this, but cannot seem to find it and really would appreciate some assistance. Have an application which uses JDBC to connect to a MySQL DB to run the following query without an issue:
    SELECT * FROM users
    This returns the desired results. Changed to connect to MS SQL Server 2000 using the JDBC-ODBC bridge and the same query returns no results. The problem, SQL Server wants this query instead:
    SELECT * FROM [users]
    I don't want to have to change queries depending on the DB, as that is supposed to be one of the advantages of JDBC. Is there a setting in MySQL (or the JDBC driver) to have it work correctly if I pass table names in []? Or is there a setting in MS SQL Server (or in the JDBC, or ODBC) to have it accept queries without the []?
    Or is there a different approach that I'm missing which would avoid this whole problem?
    Thanks,
    Matt

    I suspect your database definitions are different. It has nothing to do with your java code.
    The bracket syntax is used to indicate the more standard quoted identifiers in standard SQL.
    Thus you could do this in oracle and in MS SQL Server...
    SELECT * FROM "users"
    I suspect that the above will work for your MS SQL Server database and will not work for your Oracle database. However if you created the table in oracle and specifically used "users" (with the double quotes around the name) when creating the table then it would work.
    Of course if the database definitions are different it means you must use different SQL for each. Just as if the name of the table was 'other' rather than 'users'.

  • Oracle 8i - PL/SQL sub query not working in PROC, but works ins SQL

    I have read about certain things not working in 8i and I think this is one of them, but I was wondering if anyone had a work around. In the place of the SELECT SYSDATE FROM DUAL, I have a table look up, where I am going to look up the OCN of the corresponding VENDOR_ID ( a column in the original query ). I am doing it in a decode statement because if the first condition in the decode statement is met, that's it. But if not, it needs to look up the OCN number in this other table. Simple enough, conceptually. I thought of a view but that necessitates a SELECT statement, too. Anyway, here is the code with the appropriate text bolded:
    CREATE OR REPLACE PROCEDURE tstINS_RATE_ROUTE_RECORDS_PROC (GET_CUR_PERIOD IN DATE) IS
         CUR_PERIOD DATE;
         BEGIN
         CUR_PERIOD := GET_CUR_PERIOD;
         Insert into RATE_ROUTE (
           CVBI_KEY
         , VENDOR_ID
         , OCN
         , ST_CD
         , PERIOD
         , MDFY_DT )
         Select
           C.CVBI_KEY
         , C.VENDOR_ID
         <b>, decode( c.send_lca, 'YES', 'XXX', (SELECT SYSDATE FROM DUAL) )</b>
         , decode( c.send_lca, 'YES', 'XX', SUBSTR(C.ZLOC,5,2) )
         , CUR_PERIOD
         , TO_CHAR(SYSDATE)
         FROM
           rpt_ds1_cnt_cat c
         , cogs_resource cr
         , cogs_t1activity ct1
         , rpt_ds1_aloc_zloc_reverse_vw az
         where (C.CVBI_KEY = CR.CVBI_KEY (+)
         and  CR.PERIOD = CUR_PERIOD)
         AND  (C.CVBI_KEY = CT1.CVBI_KEY (+)
         and CT1.PERIOD = CUR_PERIOD)
         and (az.master_route_name=c.aloc||'-'||c.zloc OR az.reversed=c.aloc||'-'||c.zloc)
         END; -- INS_RATE_ROUTE_RECORDS_PROC

    have read about certain things not working in 8i and I think this is one of them,Yes as I said scalar sub-queries were also not recognized within PL/SQL in 8i.
    Re: PLS-00103: Encountered the symbol "SELECT" when expecting one of the fo
    I was wondering if anyone had a work around.Write a function that returns the value. You may incur a performance penalty from a context switch to PL/SQL, but it may be balanced by the decode optimization you are attempting.

  • Update query not working thru procedure

    Hi
    I need to update one table column based on another table column.
    thru sql statement it is working, but same statement is not working thru stored procedure.
    update target_table a set a.col2 = (select col2 from source_table b where a.id = b.id);
    Above statement is working thru sql statement ,but it is not working thru procedure.
    So Please on this.
    Regards,
    Venkat

    post the code for the procedure. Kindly use before and after the procedure statement!                                                                                                                                                                                       

  • Select for update query not working..

    hi i am tying to get this bit of ncode to work so i can then go to the next part of demonstrating a deadlock between two transactions. however i cannot go any further has my initial code does not work at all. here it goes
    //////////User A////////////////////////////////
    DECLARE
    v_salary squad.salary%TYPE := 300;
    v_pos squad.position%TYPE := 'Forward';
    BEGIN
    UPDATE squad
    SET salary = salary + v_salary
    WHERE sname = 'Henry';
    FOR UPDATE;
    UPDATE squad
    SET position = v_pos
    WHERE sname = 'Fabregas';
    COMMIT;
    END;
    //////////////////////User B/////////////
    DECLARE
    v_salary squad.salary%TYPE := 200;
    v_pos squad.position%TYPE := 'Forward';
    BEGIN
    UPDATE squad
    SET position = v_pos
    WHERE sname = 'Fabregas';
    FOR UPDATE;
    UPDATE squad
    SET salary = salary + v_salary
    WHERE sname = 'Henry';
    FOR UPDATE;
    COMMIT;
    END;
    Basicly user a creats a lock and so does user b, user b enquires a lock from user a and vice versa i.e. a deadlock

    Hi
    You get the following error:
    ORA-06550: line 8, column 7:
    PLS-00103: Encountered the symbol "UPDATE" when expecting one of the following:
    because the FOR UPDATE; is invalid in your statement.
    Try this:
    //////////User A////////////////////////////////
    DECLARE
    v_salary squad.salary%TYPE := 300;
    v_pos squad.position%TYPE := 'Forward';
    v_n number;
    BEGIN
    UPDATE squad
    SET salary = salary + v_salary
    WHERE sname = 'Henry';
    select 1 into v_n from squad
    WHERE sname = 'Fabregas'
    for update;
    UPDATE squad
    SET position = v_pos
    WHERE sname = 'Fabregas';
    COMMIT;
    END;
    //////////////////////User B/////////////
    DECLARE
    v_salary squad.salary%TYPE := 200;
    v_pos squad.position%TYPE := 'Forward';
    v_n number;
    BEGIN
    UPDATE squad
    SET position = v_pos
    WHERE sname = 'Fabregas';
    select 1 into v_n from squad
    WHERE sname = 'Henry'
    for update;
    UPDATE squad
    SET salary = salary + v_salary
    WHERE sname = 'Henry';
    COMMIT;
    END;
    To syncronize the blocks first in a SQLPlus call these two statements:
    select 1 from squad WHERE sname = 'Fabregas' for update;
    select 1 from squad WHERE sname = 'Henry' for update;
    After this start the user A code in another SQLPlus, and start the user B code. After this call rollback or commit in the first sqlplus.
    Ott Karesz
    http://www.trendo-kft.hu

  • Sql Monitor is not working for forms10g

    Hi All,
    Sql Monitor is not working for forms10g.How can i solve this problems.
    Regards
    Gopinath M

    using sqlmonitor i have traced the forms 6i (.fmx),in this case toad additional
    software sql monitor is automatically added the frmbld.exe in application.
    whatever i am doing in forms runtime the sqlmonitor provide the sql query.
    for examble i am opening the lov with the help of F9.Now the sqlmonitor trace
    the sql query for that lov item.so its very helpful to see the query without
    the source(.fmb).
    Now the problem is the sqlmonitor is not added the iexplore.exe in application.
    because it added frmbld.exe only not for iexplore.exe.but the 10g forms are
    running from the explorer.is there any other forms trace method is available
    pls kindly guide to me.

  • Oracle date parameter query not working?

    http://stackoverflow.com/questions/14539489/oracle-date-parameter-query-not-working
    Trying to run the below query, but always fails even though the parameter values matches. I'm thinking there is a precision issue for :xRowVersion_prev parameter. I want too keep as much precision as possible.
    Delete
    from CONCURRENCYTESTITEMS
    where ITEMID = :xItemId
    and ROWVERSION = :xRowVersion_prev
    The Oracle Rowversion is a TimestampLTZ and so is the oracle parameter type.
    The same code & query works in Sql Server, but not Oracle.
    Public Function CreateConnection() As IDbConnection
    Dim sl As New SettingsLoader
    Dim cs As String = sl.ObtainConnectionString
    Dim cn As OracleConnection = New OracleConnection(cs)
    cn.Open()
    Return cn
    End Function
    Public Function CreateCommand(connection As IDbConnection) As IDbCommand
    Dim cmd As OracleCommand = DirectCast(connection.CreateCommand, OracleCommand)
    cmd.BindByName = True
    Return cmd
    End Function
    <TestMethod()>
    <TestCategory("Oracle")> _
    Public Sub Test_POC_Delete()
    Dim connection As IDbConnection = CreateConnection()
    Dim rowver As DateTime = DateTime.Now
    Dim id As Decimal
    Using cmd As IDbCommand = CreateCommand(connection)
    cmd.CommandText = "insert into CONCURRENCYTESTITEMS values(SEQ_CONCURRENCYTESTITEMS.nextval,'bla bla bla',:xRowVersion) returning ITEMID into :myOutputParameter"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.ReturnValue
    p.DbType = DbType.Decimal
    p.ParameterName = "myOutputParameter"
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion"
    v.Value = rowver
    cmd.Parameters.Add(v)
    cmd.ExecuteNonQuery()
    id = CType(p.Value, Decimal)
    End Using
    Using cmd As IDbCommand = m_DBTypesFactory.CreateCommand(connection)
    cmd.CommandText = " Delete from CONCURRENCYTESTITEMS where ITEMID = :xItemId and ROWVERSION = :xRowVersion_prev"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.Input
    p.DbType = DbType.Decimal
    p.ParameterName = "xItemId"
    p.Value = id
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion_prev"
    v.Value = rowver
    v.Precision = 6 '????
    cmd.Parameters.Add(v)
    Dim cnt As Integer = cmd.ExecuteNonQuery()
    If cnt = 0 Then Assert.Fail() 'should delete
    End Using
    connection.Close()
    End Sub
    Schema:
    -- ****** Object: Table SYSTEM.CONCURRENCYTESTITEMS Script Date: 1/26/2013 11:56:50 AM ******
    CREATE TABLE "CONCURRENCYTESTITEMS" (
    "ITEMID" NUMBER(19,0) NOT NULL,
    "NOTES" NCHAR(200) NOT NULL,
    "ROWVERSION" TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL)
    STORAGE (
    NEXT 1048576 )
    Sequence:
    -- ****** Object: Sequence SYSTEM.SEQ_CONCURRENCYTESTITEMS Script Date: 1/26/2013 12:12:48 PM ******
    CREATE SEQUENCE "SEQ_CONCURRENCYTESTITEMS"
    START WITH 1
    CACHE 20
    MAXVALUE 9999999999999999999999999999

    still not comming...
    i have one table each entry is having only one fromdata and one todate only
    i am running below in sql it is showing two rows. ok.
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  '830' and  '850'  and t1.U_frmdate ='20160801'  and  t1.u_todate='20160830'
    in commond promt
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  {?FromEmid} and  {?ToEmid} and t1.U_frmdate ={?FDate} and  t1.u_todate={?TDate}
    still not showing any results..

  • Windows update does not work after using System recovery disk

    I have a Toshiba Satellite c655 with WIndows 7 64 bit Home premium. The hard drive died on it, so I purchased a new hard drive and purchased the appropriate Recovery media from Toshiba. I followed the directions and installed the 3 disks on to the new hard drive. But Windows update does not work I get the following error: Windows update can not currently check for updates, because the service is not running. You may need to restart your PC    No matter what I try, I can not get it to work. And it will not let me install Windows Defender either. Any ideas or help would be appreciated. Thank you in advance for your time on this matter.
    Solved!
    Go to Solution.

    I get errors saying A problem is preventing the troubleshooter from starting.
    That makes two similarities to the following thread. Both Windows Update and Troubleshooters fail to work correctly.
       Trouble with reinstall of Win7 64 on a L505-ES5018
    The fix was to install a new hard disk driver.
       Intel Rapid Storage Technology
    -Jerry

  • Phone not working after OS update, phone not working after OS update

    phone not working after OS update, phone not working after OS update

    I do have a questiion.  I started the most recent iOS update on my iPhone last night and before it was ever completed a message appeared on my screen.  It is a pic of the docking/charging cord with an arrow pointing to an iTunes logo...HELP!!!!!  I have tried holding down the home key and power button several times and the same message continues to appear. 

  • Safari is not working on the Mac. Internet is fine, mail, App Store etc all working and connecting to Internet fine. Done the latest software update, still not working. When selecting a web address from bookmarks or typing in search bar, partial blue bar.

    Safari is not working on the Mac. Internet is fine. mail, App Store etc all working and connecting to Internet fine. Done the latest software update, still not working. When selecting a web address from bookmarks or typing in search bar, partial blue bar only and coloured wheel appears.

    From the Safari menu bar, select
    Safari ▹ Preferences ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.
    If you wish, you may be able to salvage the malfunctioning extension by uninstalling and reinstalling it. That will revert its settings to the defaults.
    If extensions aren't causing the problem, see below.
    Safari 5.0.1 or later: Slow or partial webpage loading, or webpage cannot be found

  • WSUS "Self-update is not working" after new certificate

    After creating a new self-signed certificate in SBS 2008 wizard we get the following error:
    Text: Self-update is not working
    Source: Windows Server Update Service
    Event id: 13042
    I know that it must be something simple. But I can not find the solution.
    Can anyone help me with this problem?
    Thanks

    Hi,
    Based on your description and this error message, this issue may be caused by:
    The Default Web Site is not running and/or has a site binding for SSL (HTTPS).
    The Selfupdate virtual directory has the "Require SSL" checked under the SSL settings.
    For more details, please refer to the following KB and check if can help you to solve this issue.
    WSUS 3.0 Self-update is not working on Windows Small Business
    Server and Event ID 13042 is generated
    If anything I misunderstand or any update, please don’t hesitate to let me know.
    Hope this helps.
    Best regards,
    Justin Gu

Maybe you are looking for

  • Can I install Windows 7 on Microsoft Surface Pro 3?

    Hi, I want to install Windows 7 on my Microsoft Surface 3 Pro, I want to know that can I install Windows 7 on MS Surface Pro 3 or if I will install Windows 7 on Surface then what features will not be available in Windows 7 Pro ? What will the issues

  • What do I need to hook up an external DVI monitor to Thunderbolt?

    I want to hook up an external DVI monitor to my new iMac. It has a thunderbolt connection. http://www.amazon.com/Apple-Mini-DisplayPort-Adapter-MB570Z/dp/B001IF5YLQ/ref=sr _1_1?ie=UTF8&qid=1309558497&sr=8-1 Is the above link what I would be looking f

  • [SOLVED] Slim 1.3.2 & Xfce - shutdown buttons doesn't work

    I'm running Xfce & Slim, and my Shutdown/restart/hibernate buttons are greyed out.. ~/.xinitrc: #!/bin/sh # ~/.xinitrc # Executed by startx (run your window manager from here) if [ -d /etc/X11/xinit/xinitrc.d ]; then for f in /etc/X11/xinit/xinitrc.d

  • Import error in 4.0.1.00.03

    Hi, I am trying to import a CSS export that came from the same version of APEX as well as the same Workspace on a different server. I keep getting this error: ORA-20001: GET_BLOCK Error. ORA-20001: Execution of the statement was unsuccessful. ORA-010

  • ThinkVantage fingerprint error 7210001 (object: clsid-not-found(CID_HomePassport::Set))

    Hi I have a Lenovo W520. When i want to open the thinkvantage fingerprints. There is the followed message: Error 7210001 (object: clsid-not-found(CID_HomePassport:et)) And i can't do anything, the window is empty. How can I fix this?