SQL syntax error...

SQL Syntax:
select ename||'-'||job from emp
Initially, I was using the .Net Framework Data Provider for Oracle and had no problem bringing up the Query Builder in VS 2008. However, when I use the ODP .Net from Oracle, I get an error when bringing up the Query Builder:
Error in SELECT clause: expression near '|'.
Unable to parse query text.
It seems like when uing ODP .Net, it does not like the concatenation in the Select statment.
Any clue why?

Is this consistently reproducible for you? Is it query builder specific? What version of ODP are you using? I just tried this with 11.1.6.20 ODP and it worked fine..
Cheers
Greg
using System;
using System.Data;
using Oracle.DataAccess.Client;
class Program
    static void Main(string[] args)
        using (OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger"))
            con.Open();
            using (OracleCommand cmd = new OracleCommand("select ename||'-'||job from emp", con))
                Console.WriteLine(cmd.ExecuteScalar().ToString());
}

Similar Messages

  • CR2011 - SQL Syntax Error

    After updating our ODBC driver to match our current Unidata database version (7.1), we now get the following message from Crystal Reports 2011 on many of our existing reports:
    "Failed to retrieve data from the database. Details: 37000:[Rocket U2][U2ODBC][1401249]Error ID: 21 Severity: ERROR Facility: DBCAPERR - SQL Syntax error. [Database Vendor Code: 5365440]
    The generated SQL statement follows:
    SELECT "INVCDETH_NF"."ITEM_NBR", "ITEMMAST_NF"."ITEM_DESC", "INVCDETH_NF"."SHIPPED_QUANTITY", "INVCDETH_NF"."Z_INV_DATE", "INVCDETH_NF"."Z_COMPANY", "INVCHDRH_NF"."INVOICE_TYPE", "INVCDETH_NF"."EXTENDED_PRICE", "INVCDETH_NF"."COST_OF_SALES", "INVCDETH_NF"."Z_PCC_CODE", "INVCDETH_NF"."DISCOUNT_AMOUNT", "INVCDETH_NF"."WAREHOUSE", "ITEMMAST_NF"."PRICE_CODE", "INVCHDRH_NF"."INVOICE_NBR", "INVCHDRH_NF"."REFERENCE_NBR"
    FROM   ("Administrators"."ITEMMAST_NF" "ITEMMAST_NF" INNER JOIN "Administrators"."INVCDETH_NF" "INVCDETH_NF" ON "ITEMMAST_NF"."ITEM_NBR"="INVCDETH_NF"."ITEM_NBR") INNER JOIN "Administrators"."INVCHDRH_NF" "INVCHDRH_NF" ON ((("INVCDETH_NF"."INVOICE_NBR"="INVCHDRH_NF"."INVOICE_NBR") AND ("INVCDETH_NF"."INV_HEADER_ID"="INVCHDRH_NF"."INV_HEADER_ID")) AND ("INVCDETH_NF"."REFERENCE_NBR"="INVCHDRH_NF"."REFERENCE_NBR")) AND ("INVCDETH_NF"."RELEASE_NBR"="INVCHDRH_NF"."RELEASE_NBR")
    WHERE  "INVCDETH_NF"."Z_COMPANY"='01' AND "INVCDETH_NF"."WAREHOUSE"='086' AND ("INVCDETH_NF"."Z_INV_DATE">={d '2013-12-08'} AND "INVCDETH_NF"."Z_INV_DATE"<={d '2013-12-26'})
    ORDER BY "INVCDETH_NF"."WAREHOUSE"
    I downloaded the trial version of CR2013 and get the same result. Can anyone shed any light? Thanks!

    Yes, in that the query is what Crystal generated from the report being built in the designer. I simply copied it from the Database > Show SQL Query screen. Since the error I'm receiving is a SQL Syntax Error, I thought it would be appropriate to show it.
    The bottom line is that because I am not very knowledgeable in SQL, I can't look at the query and identify the error. However, I am responsible for supporting CR in-house. Naturally, I have reported this to Rocket (the makers of the ODBC driver) but haven't received their reply yet.

  • Anyone see a SQL syntax error here?

    Hey all,
    I am getting an error due to a SQL syntax error. I thought this looked good...but maybe a couple more sets of eyes looking at it will see what I did...
    here it is:
    stmt.executeUpdate("UPDATE member SET (Age = '" + Agetxf.getText() + "' Location = '" + Locationtxf.getText() + "' College ='" + Collegetxf.getText() + "' Major ='" + Majortxf.getText() + "' Profession='" + Professiontxf.getText() + "') WHERE UserID ='" + CreateAccount.getUserID() + "'");
    Thanks in advance...
    Atreides

    Hi,
    Each field should be seperated with comma as below.
    stmt.executeUpdate("UPDATE member SET Age = '" + Agetxf.getText() + "', Location = '" + Locationtxf.getText() + "', College ='" + Collegetxf.getText() + "', Major ='" + Majortxf.getText() + "', Profession='" + Professiontxf.getText() + "' WHERE UserID ='" + CreateAccount.getUserID() + "'");Regards,
    Ram

  • Entry-SQL syntax error: CASE not allowed

    Hello All. When I use sap netweaver developer to develop webdynpro applications, I always meet that jdbc error.
    when using inner join,left join, or using case when in the sql, it will pop up Entry-SQL syntax error.
    But I have run the sql in Microsoft SQL Server studio successfully.
    The SQL statement "UPDATE SAPNWDDB.Z_SERIAL SET LASTSERIAL = CASE WHEN ENDWITH IS NOT NULL THEN CASE WHEN LASTSERIAL + 1 > ENDWITH THEN ISNULL(STARTWITH, 0) ELSE LASTSERIAL + 1 END ELSE LASTSERIAL + 1 END WHERE SERIALNO = ?" contains the syntax error[s]: - 1:43 - Entry-SQL syntax error: CASE not allowed
    - 1:78 - Entry-SQL syntax error: CASE not allowed
    - 1:124 - SQL syntax error: the token "(" was not expected here
    Can someone help me? Thank you.

    Hi Arun Jaiswal ,
    Thank you for your answer. But I have tried query in sql editor. Actually it can work. Other than "CASE" syntax, it seems not support inner join and left join in webdynpro either. I even can not query the db views.
    That's imposible jdbc not support these simple syntex. I wonder there is any config control the sql compatibility level.
    I have developped a java programm to test it. It is ok. No error. But the same case pop up error in java webdynpro application.I don't know why.
    I am entry level webdynpro developper.
    Hopefully you can help me.
    Thank you.
    Edited by: zegunlee330 on Sep 3, 2010 4:18 AM

  • DB2 9.7 DFACT.SQL syntax error in Import ABAP phase - System Copy

    Hi all. I'm trying a system copy with a source system SAP ECC 6.0 ehp4 based on NW 701 and db2 LUW 9.1 .
    As it seems supported by SAP, i'm using db2 LUW 9.7 in target system.
    O.S. is Windows 2008.
    I got an error in phase "Import ABAP".
    Sapinst.log says:
    INFO 2010-02-18 10:12:14.337
    An error occured and the user decided to retry the current step: "|NW_ABAP_OneHost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|1|0|NW_CreateDBandLoad|ind|ind|ind|ind|10|0|NW_ABAP_Import_Dialog|ind|ind|ind|ind|5|0|NW_ABAP_Import|ind|ind|ind|ind|0|0|runMigrationMonitor".
    INFO 2010-02-18 10:12:14.509
    Switched to user: devadm.
    INFO 2010-02-18 10:12:14.572
    Creating file C:\Program Files\sapinst_instdir\ERPEhP4\LM\COPY\DB6\SYSTEM\CENTRAL\AS-ABAP\import_monitor.java.log.
    INFO 2010-02-18 10:12:14.603
    Switched to user: devadm.
    INFO 2010-02-18 10:12:14.618
    Working directory changed to C:\Program Files\sapinst_instdir\ERPEhP4\LM\COPY\DB6\SYSTEM\CENTRAL\AS-ABAP.
    INFO 2010-02-18 10:12:14.618
    Output of C:\j2sdk1.4.2_24-x64\bin\java.exe -classpath migmon.jar -showversion -Xmx1024m com.sap.inst.migmon.imp.ImportMonitor -sapinst is written to the logfile import_monitor.java.log.
    WARNING 2010-02-18 10:12:44.790
    Execution of the command "C:\j2sdk1.4.2_24-x64\bin\java.exe -classpath migmon.jar -showversion -Xmx1024m com.sap.inst.migmon.imp.ImportMonitor -sapinst" finished with return code 103. Output:
    java version "1.4.2_24-rev"
    Java(TM) Platform, Standard Edition for Business (build 1.4.2_24-rev-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 1.4.2_24-rev-b06, mixed mode)
    Import Monitor jobs: running 1, waiting 1, completed 73, failed 0, total 75.
    Loading of 'SAPDFACT' import package: ERROR
    Import Monitor jobs: running 0, waiting 1, completed 73, failed 1, total 75.
    WARNING[E] 2010-02-18 10:12:44.790
    CJS-30022  Program 'Migration Monitor' exits with error code 103. For details see log file(s) import_monitor.java.log, import_monitor.log.
    ERROR 2010-02-18 10:12:44.790
    FCO-00011  The step runMigrationMonitor with step key |NW_ABAP_OneHost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|1|0|NW_CreateDBandLoad|ind|ind|ind|ind|10|0|NW_ABAP_Import_Dialog|ind|ind|ind|ind|5|0|NW_ABAP_Import|ind|ind|ind|ind|0|0|runMigrationMonitor was executed with status ERROR .
    Looking into import_monitor.java.log i found that the problem is in dfact import.
    I've looked into sapdfact.log and i found:
    S:\usr\sap\DEV\SYS\exe\uc\NTAMD64\R3load.exe: START OF LOG: 20100218105045
    S:\usr\sap\DEV\SYS\exe\uc\NTAMD64\R3load.exe: sccsid @(#) $Id: //bas/701_REL/src/R3ld/R3load/R3ldmain.c#8 $ SAP
    S:\usr\sap\DEV\SYS\exe\uc\NTAMD64\R3load.exe: version R7.01/V1.4 [UNICODE]
    Compiled Jan 28 2010 20:22:25
    S:\usr\sap\DEV\SYS\exe\uc\NTAMD64\R3load.exe -i SAPDFACT.cmd -dbcodepage 4103 -l SAPDFACT.log -stop_on_error -loadprocedure fast LOAD:COMPRESS_ALL
    (DB) INFO: connected to DB
    (DB6) INFO: COMPRESS YES is set during table creation.
    (DB6) DB2 9.5 automatic dictionary creation does not require an explicit REORG.
    (DB6) Compression threshold is ignored.
    (GSI) INFO: dbname   = "DEV                                                                                "
    (GSI) INFO: vname    = "DB6                             "
    (GSI) INFO: hostname = "UNKNOWN                                                         "
    (GSI) INFO: sysname  = "Windows NT"
    (GSI) INFO: nodename = "SRVSAPDEV"
    (GSI) INFO: release  = "6.0"
    (GSI) INFO: version  = "6002 Service Pack 2"
    (GSI) INFO: machine  = "4x AMD64 Level 6 (Mod 26 Step 5)"
    (DB) ERROR: DDL statement failed with SQL error
    ( ALTER TABLE "/BI0/E0PPM_VC1" DROP PRIMARY KEY  )
      (SQL error -539)
      error message returned by dsql:
    SQL0539N  Table or nickname "SAPDEV./BI0/E0PPM_VC1" does not have a "PRIMARY" key.  SQLSTATE=42888
    (IMP) INFO: a failed DROP attempt is not necessarily a problem
    (DB6) INFO: executing DDL statements for object /BI0/E0PPM_VC1 from external SQL file.
    (DB) ERROR: DDL statement failed with SQL error
    ( CREATE TYPE 2 UNIQUE INDEX "/BI0/E0PPM_VC1~0" ON "/BI0/E0PPM_VC1"   ("KEY_0PPM_VC1T" ,   "KEY_0PPM_VC11" ,   "KEY_0PPM_VC1U" ,   "KEY_0PPM_VC1P" )   USING STOGROUP ___FAI PRIQTY 16   SECQTY 10240 FREEPAGE 0 PCTFREE 0   GBPCACHE CHANGED DEFINE NO   BUFFERPOOL BP3 COPY NO   PIECESIZE 2097152 K CLUSTER NOT PADDED  )
      (SQL error -7)
      error message returned by dsql:
    SQL0007N  The character "_" following "" )   USING STOGROUP" is not valid.  SQLSTATE=42601
    (DB) INFO: disconnected from DB
    S:\usr\sap\DEV\SYS\exe\uc\NTAMD64\R3load.exe: job finished with 1 error(s)
    S:\usr\sap\DEV\SYS\exe\uc\NTAMD64\R3load.exe: END OF LOG: 20100218105045
    So as you can see it seems that there's some syntax error in dfacl.log. The wrong SQL statement referred by sapdfact.log is
    ind: /BI0/E0PPM_VC1~0
    sql: CREATE TYPE 2 UNIQUE INDEX "/BI0/E0PPM_VC1~0" ON "/BI0/E0PPM_VC1"
      ("KEY_0PPM_VC1T" ,
      "KEY_0PPM_VC11" ,
      "KEY_0PPM_VC1U" ,
      "KEY_0PPM_VC1P" )
      USING STOGROUP ___FAI PRIQTY 16
      SECQTY 10240 FREEPAGE 0 PCTFREE 0
      GBPCACHE CHANGED DEFINE NO
      BUFFERPOOL BP3 COPY NO
      PIECESIZE 2097152 K CLUSTER NOT PADDED ;
      |
      ALTER TABLE "/BI0/E0PPM_VC1"
      ADD PRIMARY KEY ("KEY_0PPM_VC1T",
      "KEY_0PPM_VC11",
      "KEY_0PPM_VC1U",
      "KEY_0PPM_VC1P") ;
    Am i missing something?
    Data in referred tables (infocubes) isn't really important.
    Is there a safe way to proceed?
    Thanks in advance.
    Regards
    Simone Zaffalon

    And this is the strange point: my source system is not a BI and my dataclasses .SQL files are not empty.
    Me too i would expect that the files should be empty but instead they are full of object definitions.
    For example i have APPL0.SQL that contains a list of all tables of ECC system, for example
    tab: MAMT
    sql:     CREATE TABLE "MAMT"
            ("MANDT" SAPDB6VARCHAR(000003)
            DEFAULT '000' NOT NULL,
            "MATNR" SAPDB6VARCHAR(000018)
            DEFAULT ' ' NOT NULL,
            "SPRAS" SAPDB6VARCHAR(000001)
            DEFAULT ' ' NOT NULL,
            "MEINH" SAPDB6VARCHAR(000003)
            DEFAULT ' ' NOT NULL,
            "MTXID" SAPDB6VARCHAR(000002)
            DEFAULT ' ' NOT NULL,
            "LFDNR" SAPDB6VARCHAR(000002)
            DEFAULT '00' NOT NULL,
            "MAKTM" SAPDB6VARCHAR(000040)
            DEFAULT ' ' NOT NULL)
            IN "&location&"
            INDEX IN "&locationI&"
            LONG  IN "&locationL&"
          COMPRESS YES;
          ALTER TABLE "MAMT" LOCKSIZE ROW;
    and like this for all others tables.
    What would occur if i launch an import with such .SQL files?
    (shuld i put this question to another thread or is fine for you to answer on this?)
    Thank you again.
    Simone Zaffalon

  • MS SQL - Syntax error for valid query

    I have a problem with the second query in this code (gives me
    a syntax error in my HAVING line)
    <cfquery name="getDupes" datasource="#application.ODBC1#"
    dbtype="ODBC" username="#application.userNameODBC1#"
    password="#application.userPassODBC1#">
    SELECT *
    FROM view_FormCount
    WHERE formCount >= 2
    ORDER BY formNum
    </cfquery>
    <cfset variables.lstForms = "">
    <cfoutput query="getDupes">
    <cfset variables.lstForms=
    listAppend(variables.lstForms,"'#getDupes.formNum#'")>
    </cfoutput>
    <cfset variables.whereClause = "(formNum =
    #ReplaceNoCase(variables.lstForms,',',' OR formNum =
    ','ALL')#)">
    <cfquery name="getDetails"
    datasource="#application.ODBC1#" dbtype="ODBC"
    username="#application.userNameODBC1#"
    password="#application.userPassODBC1#">
    SELECT tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr
    FROM tblForms INNER JOIN tblCompanies ON tblForms.formCustNum
    = tblCompanies.companyNum
    GROUP BY tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr
    HAVING #variables.whereClause#
    ORDER BY tblForms.formNum, tblForms.formCustNum
    </cfquery>
    Now, the really odd thing is if I just take the query text
    out of the CFQUERY tags and use CFOUTPUT instead (to see in my
    browser what query is getting executed) I get a query that I can
    paste into Enterprise Mgr and runs fine.
    I can even paste the resulting text into my code in a CFQUERY
    and CF will run it fine.
    In other words, the dynamic version query gives me an error,
    but if I just output the SQL statement, copy-and-paste that into
    the CFQUERY that's erroring out (replacing what's there) to run as
    a static query, it works fine (sample of static query below).
    The error I get when I try to do it dynamically is "Error
    Executing Database Query. [Macromedia][SQLServer JDBC
    Driver][SQLServer]Line 4: Incorrect syntax near '10169318'. The
    error occurred on line 21." which is where the HAVING clause
    starts.
    SELECT tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr FROM tblForms INNER
    JOIN tblCompanies ON tblForms.formCustNum = tblCompanies.companyNum
    GROUP BY tblForms.formNum, tblForms.formName, tblForms.formCustNum,
    tblCompanies.companyAbbr HAVING (formNum = '10169318' OR formNum =
    '1016CONCERTA' OR formNum = '1016NSAIDS' OR formNum =
    '1016STRATTERA' OR formNum = '1016WELLBUTRIN' OR formNum =
    '18504211' OR formNum = '185093807' OR formNum = '73208565' OR
    formNum = '732120027' OR formNum = '7322154' OR formNum = '7323402'
    OR formNum = '7323522' OR formNum = '73238900' OR formNum =
    '7324211' OR formNum = '7324211S' OR formNum = '7324265' OR formNum
    = '73242891' OR formNum = '732434341' OR formNum = '732434342' OR
    formNum = '73243435' OR formNum = '73243436' OR formNum =
    '73243439' OR formNum = '73243440' OR formNum = '73243441' OR
    formNum = '73243442' OR formNum = '73243443' OR formNum = '7324359'
    OR formNum = '7324360' OR formNum = '7324370' OR formNum =
    '7324560' OR formNum = '7324959' OR formNum = '7326411ptreg' OR
    formNum = '7326599' OR formNum = '7326600' OR formNum = '7326620'
    OR formNum = '7326707' OR formNum = '7326931' OR formNum =
    '7328410' OR formNum = '732851031TOP' OR formNum = '7328512' OR
    formNum = '7328548' OR formNum = '7328548P2' OR formNum =
    '7328548P3' OR formNum = '7328548P4' OR formNum = '73289400' OR
    formNum = '73290D' OR formNum = '7329154' OR formNum =
    '73291544JHS' OR formNum = '73291545JHS' OR formNum =
    '73291546JHSMH' OR formNum = '73291547JHSMH' OR formNum = '7329174'
    OR formNum = '7329308' OR formNum = '7329402' OR formNum =
    '7329424' OR formNum = '7329455' OR formNum = '7329520' OR formNum
    = '7329539' OR formNum = '73297701JH' OR formNum = '73298273' OR
    formNum = '73298400' OR formNum = '73298403' OR formNum =
    '73298404' OR formNum = '7329883' OR formNum = '73298860' OR
    formNum = '7329887' OR formNum = '73298974' OR formNum = '7329899'
    OR formNum = '7329899S' OR formNum = '73299190' OR formNum =
    '7329987' OR formNum = '7329999PTO' OR formNum = '732AV5160' OR
    formNum = '732CMHFRAZ' OR formNum = '732HIPAA' OR formNum =
    '732HIPAAFLYERS' OR formNum = '734HEART' OR formNum = '7444711' OR
    formNum = '7449230' OR formNum = '744HR4991' OR formNum =
    '7538014MI' OR formNum = '77511044' OR formNum = '77511045' OR
    formNum = '775stampnochange' OR formNum = '80851001BLUE' OR formNum
    = '80MR4200' OR formNum = '80MR4273' OR formNum = '80MR4274' OR
    formNum = '80MR4300' OR formNum = '80MR9934' OR formNum =
    '80MR9935' OR formNum = '80SHC100' OR formNum = '80SHC4301' OR
    formNum = '80SHC9830' OR formNum = '80SHC9832') ORDER BY
    tblForms.formNum, tblForms.formCustNum

    AWFrueh1808 wrote:
    > OK, that's simple enough. But then I'm really confused
    as to why the query in
    > my original post/example didn't work.
    >
    > The only single quotes in my #whereClause# variable were
    wrapped around each
    > varchar value in the WHERE clause (well, HAVING) as in
    HAVING formNum = '12345'
    > OR formNum = '54321'
    >
    > I never used a single quote within the value itself. And
    yet
    > preservesinglequotes fixed it. So what was CF doing? Why
    did the single
    > quotes still show up in the error msg - and in the right
    place?
    >
    As I said the default behavior is to escape the quotes in
    your variables
    as data. So the default output of your SQL statement, before
    preserveSingleQuotes() would be like this.
    HAVING formNum = ''12345'' OR formNum = ''54321''
    As you can see that is not the desired results in your case.
    In your
    case you have the proper number of single quotes in your
    string and you
    do not want any added. You want to preserve them so to say.
    Thus
    adding preserveSingleQuotes() around your whereClase
    variable, i.e.
    preserveSingleQuotes(whereClause) says do not add any quotes,
    keep them
    all single.

  • CMP bean : 'create' method fails - SQL Syntax error

    I'm using SilverStream 3.7.3 server on Win 2K.
    In a CMP entity bean, call to any create method ( default using primary key or with any other list of parameters ) fails , giving this error :
    javax.ejb.CreateException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    <<no stack trace available>>
    I've doubly checked for mismatch between types of database columns & parameters passed, but there is no difference. ( Another BMP bean uses same types and it's working perfectly )
    Interestingly, the 'finder' & other business methods are working without any problem.
    Any idea about cause of this error / options to solve / get around the prob?
    TIA,
    Subodh

    Hi,
    See if you can get SilverStream to give you the JDBC statements it is sending to Access. If SilverStream can't do that, try using P6Spy to get hold of the JDBC. Once you have the SQL, you should be able to figure out where the prolbem is... and if you can do anything about it.
    Does access actually accept any form of Standard SQL?
    Daniel.

  • SQL syntax error when creating record insertion form

    Good day,
    I was hoping someone could help me.  I am trying to create a record insertion form on a website to insert data into a database table.  When attempting to create the form, I am getting the following error: 
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' Organization, Office, Department, Phone, EmailAddress, JobTitle, `OfficialMaili' at line 1
    Not sure what is going on.  I am running windows 8 and DW cs5 w/ MYSQL.  I am testing on a local server prior to pushing to the remote server.
    Thank you for your assistance and please advise any code you would like me to send.

    Here is all the code from this particular webpage.  I apologize, I am too stupid to realize which parts are SQL vice PHP vice HTML:
    <?php require_once('Connections/group4.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
       if (PHP_VERSION < 6) {
         $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
         case "text":
           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
           break;   
         case "long":
         case "int":
           $theValue = ($theValue != "") ? intval($theValue) : "NULL";
           break;
         case "double":
           $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
           break;
         case "date":
           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
           break;
         case "defined":
           $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
           break;
       return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
       $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
       $insertSQL = sprintf("INSERT INTO individual (Grade, LastName, FirstName, M.I., Organization, Office, Department, Phone, EmailAddress, JobTitle, `OfficialMailing Address`, Citizenship, Designation, IATrainingComplete, IADate) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                            GetSQLValueString($_POST['Grade'], "text"),
                            GetSQLValueString($_POST['LastName'], "text"),
                            GetSQLValueString($_POST['FirstName'], "text"),
                            GetSQLValueString($_POST['MI'], "text"),
                            GetSQLValueString($_POST['Organization'], "text"),
                            GetSQLValueString($_POST['Office'], "text"),
                            GetSQLValueString($_POST['Department'], "text"),
                            GetSQLValueString($_POST['Phone'], "double"),
                            GetSQLValueString($_POST['EmailAddress'], "text"),
                            GetSQLValueString($_POST['JobTitle'], "text"),
                            GetSQLValueString($_POST['OfficialMailing_Address'], "text"),
                            GetSQLValueString($_POST['Citizenship'], "text"),
                            GetSQLValueString($_POST['Designation'], "text"),
                            GetSQLValueString($_POST['IATrainingComplete'], "text"),
                            GetSQLValueString($_POST['IADate'], "text"));
      mysql_select_db($database_group4, $group4);
       $Result1 = mysql_query($insertSQL, $group4) or die(mysql_error());
      $insertGoTo = "index.php";
       if (isset($_SERVER['QUERY_STRING'])) {
         $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
         $insertGoTo .= $_SERVER['QUERY_STRING'];
       header(sprintf("Location: %s", $insertGoTo));
    mysql_select_db($database_group4, $group4);
    $query_rsIndividual = "SELECT * FROM individual ORDER BY IndividualNumber ASC";
    $rsIndividual = mysql_query($query_rsIndividual, $group4) or die(mysql_error());
    $row_rsIndividual = mysql_fetch_assoc($rsIndividual);
    $totalRows_rsIndividual = mysql_num_rows($rsIndividual);
    ?>
    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Contact Us</title>
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    .header {
      font-size: 36px;
      text-decoration: underline;
    .quote {
      font-size: 18px;
      font-style: italic;
    .tablethisone {
      margin: 5px;
      padding: 25px;
      border: medium none #000;
      text-align: center;
    </style>
    </head>
    <body>
    <p><img src="Images/EGA.png" width="227" height="222" alt="EGA" /><span class="header">SAAR Tracking System
    </span></p>
    <ul id="MenuBar1" class="MenuBarHorizontal">
       <li><a href="index.php">Home</a>  </li>
       <li><a href="search.php">Search</a></li>
       <li><a href="contact.php">Contact Us</a>  </li>
    </ul>
    <p> </p>
    <p>PRIVACY ACT STATEMENT</p>
    <p>Executive Order 10450, 9397; and Public Law 99-474, the Computer Fraud and Abuse Act.
       To record names, signatures, and other identifiers for the purpose of validating the trustworthiness of individuals requesting
       access to Department of Defense (DoD) systems and information. NOTE: Records may be maintained in both electronic
       and/or paper form.</p>
    <p> </p>
    <p> </p>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
       <table align="center">
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">Grade:</td>
           <td><input type="text" name="Grade" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">LastName:</td>
           <td><input type="text" name="LastName" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">FirstName:</td>
           <td><input type="text" name="FirstName" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">M.I.:</td>
           <td><input type="text" name="MI" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">Organization:</td>
           <td><input type="text" name="Organization" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">Office:</td>
           <td><input type="text" name="Office" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">Department:</td>
           <td><input type="text" name="Department" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">Phone:</td>
           <td><input type="text" name="Phone" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">EmailAddress:</td>
           <td><input type="text" name="EmailAddress" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">JobTitle:</td>
           <td><input type="text" name="JobTitle" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">OfficialMailing Address:</td>
           <td><input type="text" name="OfficialMailing_Address" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">Citizenship:</td>
           <td><input type="text" name="Citizenship" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">Designation:</td>
           <td><input type="text" name="Designation" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">IATrainingComplete:</td>
           <td><input type="text" name="IATrainingComplete" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right">IADate:</td>
           <td><input type="text" name="IADate" value="" size="32" /></td>
         </tr>
         <tr valign="baseline">
           <td nowrap="nowrap" align="right"> </td>
           <td><input type="submit" value="Insert record" /></td>
         </tr>
       </table>
       <input type="hidden" name="MM_insert" value="form1" />
    </form>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p>Disclosure of this information is voluntary; however, failure to provide the requested information may impede, delay or
    prevent further processing of this request.</p>
    <p class="quote">&quot;Be polite, be professional, but have a plan to kill everybody you meet&quot; General James Mattis</p>
    <p> </p>
    <script type="text/javascript">
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
    </script>
    </body>
    </html>
    <?php
    mysql_free_result($rsIndividual);
    ?>

  • Certain characters create SQL Syntax error?

    I am trying to insert a string into a database that is written in a JTextArea, however if the string contains certain characters it causes a syntax error. Can anyone tell me what characters will create syntax errors? I assume a single quote will but what other characters should I be aware of? Is there anything I can do so I can keep the characters without getting syntax errors. I saw something called Regex that may help but I am unsure exactly how to use it and if it is the appropriate action. Any help would be appreciated. Thank you in advance.

    Thanks for all the feedback. I have tried implementing a preparedstatement as follows:
    String insertNew = "INSERT INTO MyMovies VALUES (?,?,?,?,?,?,?)";
                                PreparedStatement preStatement = databaseConnection.prepareStatement(insertNew);
                                preStatement.setString(1,addTitle);
                                preStatement.setString(2,addDescr);
                                preStatement.setInt(3,year);                       
                                preStatement.setString(4,addGenre);
                                preStatement.setString(5,addRating);
                                preStatement.setDouble(6,stars2);
                                preStatement.setInt(7,runtime);
                                preStatement.executeUpdate();
                                preStatement.close();But I get the error -- Number of query values and destination fields are not the same.
    It sure looks like there the same. Am I missing something? I have looked over some material containing prepared statements and I seem to be doing what has been shown as examples.

  • Access 2013 SQL syntax error for experts

    SELECT Box_Dtl.N_Code, Box_Dtl.Box_Num, Box_Dtl.Cur_BarCount, IIf(z_nRes.rQty Is Null, 0,z_nRes.rQty) AS rQty,
    Box_Dtl.Cur_BarCount - IIf(z_nRes.rQty Is Null, 0,z_nRes.rQty) AS bBal, Box_Dtl.PO, Box_Dtl.Cert, Box_Dtl.Rec_Date,
    IIf(z_TotalBars.Bars Is Null, 0,z_TotalBars.Bars) AS tBars, IIf(z_TotalRes.rBars Is Null, 0,z_TotalRes.rBars) AS rBars, IIf(z_TotalBars.Bars Is Null, 0,z_TotalBars.Bars)
    - IIf(z_TotalRes.rBars Is Null, 0,z_TotalRes.rBars) AS Bal, Box_Dtl.Cost_Bar, Box_Dtl.Weight, Box_Dtl.Location_Code, Box_Dtl.Notes, DEFARS
    FROM ([ODBC;Description=D4;DRIVER=SQL Server;SERVER=DEVELOPMENT;Trusted_Connection=Yes;DATABASE=RawMaterial_LV].z_TotalRes
    RIGHT OUTER JOIN [ODBC;Description=D4;DRIVER=SQL Server;SERVER=DEVELOPMENT;Trusted_Connection=Yes;DATABASE=RawMaterial_LV].Box_Dtl)
    LEFT OUTER JOIN [ODBC;Description=D4;DRIVER=SQL Server;SERVER=DEVELOPMENT;Trusted_Connection=Yes;DATABASE=RawMaterial_LV].z_nRes ON Box_Dtl.Box_Num = z_nRes.Box
    LEFT OUTER JOIN [ODBC;Description=D4;DRIVER=SQL Server;SERVER=DEVELOPMENT;Trusted_Connection=Yes;DATABASE=RawMaterial_LV].z_TotalBars ON Box_Dtl.N_Code = z_TotalBars.M_Code ON z_TotalRes.M_Code = Box_Dtl.N_Code
    WHERE (Box_Dtl.Finished = 0) AND (Box_Dtl.N_Code = 'AL---2011--------T3-.6875R12')
    error messagesyntax error in  FROM clause

    SELECT Box_Dtl.N_Code, Box_Dtl.Box_Num, Box_Dtl.Cur_BarCount, IIf(z_nRes.rQty Is Null, 0,z_nRes.rQty) AS rQty,
    Box_Dtl.Cur_BarCount - IIf(z_nRes.rQty Is Null, 0,z_nRes.rQty) AS bBal, Box_Dtl.PO, Box_Dtl.Cert, Box_Dtl.Rec_Date,
    IIf(z_TotalBars.Bars Is Null, 0,z_TotalBars.Bars) AS tBars, IIf(z_TotalRes.rBars Is Null, 0,z_TotalRes.rBars) AS rBars, IIf(z_TotalBars.Bars Is Null, 0,z_TotalBars.Bars)
    - IIf(z_TotalRes.rBars Is Null, 0,z_TotalRes.rBars) AS Bal, Box_Dtl.Cost_Bar, Box_Dtl.Weight, Box_Dtl.Location_Code, Box_Dtl.Notes, DEFARS
    FROM ([ODBC;Description=D4;DRIVER=SQL Server;SERVER=DEVELOPMENT;Trusted_Connection=Yes;DATABASE=RawMaterial_LV].z_TotalRes
    RIGHT OUTER JOIN [ODBC;Description=D4;DRIVER=SQL Server;SERVER=DEVELOPMENT;Trusted_Connection=Yes;DATABASE=RawMaterial_LV].Box_Dtl)
    (LEFT OUTER JOIN [ODBC;Description=D4;DRIVER=SQL Server;SERVER=DEVELOPMENT;Trusted_Connection=Yes;DATABASE=RawMaterial_LV].z_nRes ON Box_Dtl.Box_Num = z_nRes.Box)
    LEFT OUTER JOIN [ODBC;Description=D4;DRIVER=SQL Server;SERVER=DEVELOPMENT;Trusted_Connection=Yes;DATABASE=RawMaterial_LV].z_TotalBars ON Box_Dtl.N_Code = z_TotalBars.M_Code ON z_TotalRes.M_Code = Box_Dtl.N_Code
    WHERE (Box_Dtl.Finished = 0) AND (Box_Dtl.N_Code = 'AL---2011--------T3-.6875R12')
    --Prashanth

  • SQL syntax error different between enviroments after converting to column store indexes

    We have two 'identical' SQL boxes with SQL 2012 enterprise edition installed.  In our Developer enviroment only, we just converted to Column Store indexes. Now when we run this SQL, we get the following error message, ONLY in the Dev enviroment
    SELECT DISTINCT RatingDescription
    FROM Rating
    where RatingDescription > 1
    Msg 245, Level 16, State 1, Line 2
    Conversion failed when converting the varchar value 'No Rating Needed' to data type int.
    However, this SQL works in our production enviroment and the prod enviroment has the same data and schema as DEV.  As soon as we disable the column store index on the dev box, the SQL works without any problems.  Is this a known feature or bug
    that anyone knows about?
    Additional info:
    The RatingDescription field is a varchar(100) and contains numbers and text.
    Current SQL server editions on both servers:
    Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64) 
    Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )

    So I need to amend my statement. 
    This statement does fail as everyone is saying:  
    SELECT DISTINCT RatingDescription
    FROM Rating
    where RatingDescription > 1However, this statement does not failSELECT DISTINCT RatingDescription 
     FROM Rating 
     where RatingDescription > 1
     AND analystName = 'Bob'I left out the analystName critiera because I didnt think it mattered but clearly it allows the SQL to run because Bob has no text for ratings. However my finding are still true, that this exact SQL runs successfullywhen I disable the CS index, and as soon as I enable/rebuild it it fails with the message Conversion failed when converting the varchar value.

  • Syntax error while creating Calculation view script based

    Hi Folks,
    I'm creating Calc view based on script and drafted a simple code but I'm getting syntax error.
    Its just fetching few coloumns from two tables products and purchaseorderitem.
    /********* Begin Procedure Script ************/
    BEGIN
      var_out = select productid , category, nameid, currency, grossamount, quantity
      FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS B
      where P.productid = B.productid;
    END /********* End Procedure Script ************/
    Could you pls take a look and let me know what wrong I'm doing?
    Error logs are:-
    sap.hana..package.project.folder.mytest.CALCSCRIPTVIEWInternal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: sql syntax error: incorrect syntax near "democontent": line 5 col 18 (at pos 439)nSet Schema DDL statement: set schema "SYSTEM"nType DDL: create type "_SYS_BIC"."sap.hana..package.project.folder.mytest/CALCSCRIPTVIEW/proc/tabletype/VAR_OUT" as table ("PRODUCTID" NVARCHAR(10), "CATEGORY" NVARCHAR(2), "NAMEID" NVARCHAR(10), "CURRENCY" NVARCHAR(5), "GROSSAMOUNT" DECIMAL(15,2), "QUANITYT" DECIMAL(13,3))nProcedure DDL: create procedure "_SYS_BIC"."sap.hana.package.project.folder.mytest/CALCSCRIPTVIEW/proc" ( OUT var_out "_SYS_BIC"."sap.hana.package.project.folder.mytest/CALCSCRIPTVIEW/proc/tabletype/VAR_OUT" ) language sqlscript sql security definer reads sql data as n /********* Begin Procedure Script ************/ n BEGIN n t var_out = select productid , category, nameid, currency, grossamount, quantityn t FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS Bn t where P.productid = B.productid;nnEND /********* End Procedure Script ************/n

    Hi Rubane,
    I don't have EPM installed here but based on this Table User Defined Functions( Table UDF ) in HANA  you are not properly defining the source table.
    In your case missing 1) schema of EPM, 2) not using double quotes, 3) separation of package and view, 4) missing camel case on purchaseOrderItem:
    FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS B
    On blog:
    from "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::businessPartner" as a
    SAP_HANA_EPM_DEMO is the schema
    sap.hana.democontent.epm.data is the package
    businessPartner is the view
    Start simple... before the seletion try it out on Studio SQL.
    Regards, Fernando Da Rós

  • Syntax error in ce_projection

    I am writing an sql script CV to join two fact tables and display the data based on row filter.Please see the script below.
    When trying to validate the view,it triggers the below error. I couldn't figure out the sytax error in above script. can anyone help me.

    Below is the error message sumeet.
    "Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: sql syntax error: incorrect syntax near "B1": line 11 col 84 (at pos 557)nSet Schema DDL statement: set schema"
    I was trying to understand CE_PROJECTION function by using it on the join result. But couldn't do it due to the error.

  • Syntax error when creating a user-defined table type in SQL Server 2012

    Why am I getting a syntax error when creating a user-defined table type in SQL Server 2014?
    CREATE TYPE ReportsTableType AS TABLE 
    ( reportId INT
    , questionId INT
    , questionOrder INT );
    Results:
    Msg 156, Level 15, State 1, Line 1
    Incorrect syntax near the keyword 'AS'.

    Hope these posts could help, 
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/37a45a9a-ed8c-4655-be93-f6e6d5ef44be/getting-incorrect-syntax-while-creating-a-table-type-in-sql-server-2008-r2?forum=transactsql
    Regards, Dineshkumar,
    Please Mark as Answer if my post answers your question and
    Vote as Helpful if it helps you

  • No syntax errors in a sql query

    Hello,
    We are trying to eliminate Toad from our Standards. One of our people did a test for me to decided weather or not to go with SQL Developer. He compared TOAD with SQL Developer & SQL Plus. He intentially put select * ffrr table_name; to see if it would throw an error. TOAD gave an ORA-00923, SQL Plus gave the same, SQL Developer did not give anything but ran the sql. If I tell users to use this product and they are not exactly familiar with sql and they had syntax errors they wouldn't know if the sql ran properly or not.
    Is there a work around. My company will not provide any more TOAD licenses. I'm trying to find a solution for helping our users do their job but get the right results. Any suggestions would be welcome. This product is still new to me. They bought the DBA's the licenses we need but came up short for the end users.
    Thanks
    CJ

    When I try to run
    select * ffrr dual;in SQL Developer 1.2.1 (3200), I get an alert box reporting an ORA-00923 error. Does this not happen on your machine?

Maybe you are looking for