SQL Syntax check

Hello all,
Is there a way to check sql syntax against the dataabse/table without acctually running against the table ?? If you are familar with RMAN...it has a rman syntax check cmd.. ( RMAN> rman checksyntax )....which will tell you if its a valid statment or not...
is there anything similar for sqlplus ??? i am on 10.2.0.3 on Solrais....Something where i can run select * from emp; but not actually execute the statment against the database ??

For SQLPLUS you can do this.
SQL> set autotrace traceonly ;
SQL> select * from dual ;
Execution Plan
Plan hash value: 272002086
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
Statistics
         24  recursive calls
          0  db block gets
          6  consistent gets
          4  physical reads
          0  redo size
        407  bytes sent via SQL*Net to client
        380  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed
SQL> select * fromm dual ;
select * fromm dual
ERROR at line 1:
ORA-00923: FROM keyword not found where expectedSS

Similar Messages

  • SQL Developer 1.1.0.21: Issues with Data Grid and SQL syntax checking

    In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion.
    Is there any option to change this behavior?
    Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check.
    I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql.
    Manish

    "In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion."
    In the "Results" tab, Click Ctrl & Tab keys (at the same time) or with mouse click on any cell other than the first column (a sequence or rownum), you will be able to navigate using the arrow keys.
    "Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check."
    The 0.0134 seconds could be the result of the most recently executed successful statement. Check the Script Output tab for errors. Use F5 (Run Script option) instead of F9.
    "I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql."
    On the SQL statement (or code), Right Click -> Format SQL (or press Ctrl & B), proper formatting would help.
    I use version 1.0.0.15.57 and seems to be working allright.
    - Babu Rangasamy

  • SQL Syntax Checker

    Hello,
    I'm curious if there is any tool out there for checking the SQL syntax in the Java program itself. A tool to somehow validate the SQL before sending it thru the JDBC to execute the query on the database.
    If so, can you please refer me to one.
    Thanks

    I think the problem is different DBMS accepts different SQL. Even different version of DBMS.
    There is no way to make sure 100% accurate of SQL.
    The only way to make sure the SQL is accurate to any DBMS is running it and catch it in exception.
    If you SQL is not produced on run time, you can simply check it by the batch utils. For example the sql plus.

  • SQL Syntax Issue

    This is a weird one!!!
    I am using Dreamweaver/php/mysql and I am in the process of
    developing the forms that edit articles that have been added to the
    CMS. I have a page called edit.php which has the current list of
    articles. Each article has a radio button next to it and have given
    it an id of "id" (which is what I called it in the DB). On
    selecting this article, and hitting submit, this should load up a
    editnews2.php. On editnews2.php I have a filtered recordset that
    filters on "id " so that it loads the article selected into the
    editnews2 form. I have bound the fields in the form to the related
    fields in the recordset.
    When I test this out using the TEST button, in the recordset
    pop-up window and enter an id, it retrieves the correct article
    from the database. However, when I do it using the forms, I get an
    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 " at line 1"
    This is really weird because the recordset works and
    retreives the data no problems, which mean the connection file path
    is correct and other parameters are correct. I have tried lots of
    times to try and figure this out but I am now really stuck.
    Could anyone shed some light on this one?
    regards
    orange22

    orange22 wrote:
    > When I test this out using the TEST button, in the
    recordset pop-up window and
    > enter an id, it retrieves the correct article from the
    database. However, when
    > I do it using the forms, I get an 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 " at line 1"
    What that means is that the way Dreamweaver is building your
    query
    contains a mistake - probably an extra quotation mark or
    something like
    that.
    Go into Code view and use echo to display the actual SQL
    query being
    sent to the database. That will give you a clue as to where
    to start
    troubleshooting the rest of the code.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Error in SQL syntax

    Hi all,
    I have an SQL database which up untli about 20 minutes ago was fine.  I have a complex contact form whic is (was) all finished.  I have added a couple more tables to the database (now totalling 4), in order to create a registration / login page.
    (Is it okay to have 4 tables in 1 database?)
    Anyway.  I have just finished with the login stuff and all works fine.  I decided to have a quick look around the site and make sure everything is okay - but for some reason when I navigate to the "complex contact form" - I get this message:
    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 'ASCE LIMIT 0, 150' at line 1
    The registration wizard and login pages still work, and in general the site is browseable.  But this page will not work and I have no idea why?
    Does anyone have any suggestion?  All I have done since it worked is add 2 other tables as I said....
    Thank you / please help!
    NJ

    There was a typo in my previous post. There should be only one $ in $query_recordsetName. I should also have added that "recordsetName" is the name of your recordset. I would have thought it was obvious, but I see you're limiting the number of results, so the name is slightly different.
    The other thing is that you have not put it where I told you. Apart from that...
    $query_rscontacts1 = "SELECT contacts.Logo, contacts.Industries,
    contacts.coverage, contacts.misc, contacts.id, contacts.email,
    contacts.website FROM contacts WHERE {$NXTFilter_rscontacts1} ORDER BY
    {$NXTSort_rscontacts1}";
    $query_limit_rscontacts1 = sprintf("%s LIMIT %d, %d", $query_rscontacts1, $startRow_rscontacts1, $maxRows_rscontacts1);
    echo $query_limit_rscontacts1 . '<br />';
    $rscontacts1 = mysql_query($query_limit_rscontacts1, $Contacts) or die(mysql_error());

  • Error with SQL syntax

    I'm trying to get onto a website i could normally get into but all it says is this
    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') and adlx.'action' !=  2' at line 1
    I'm not good with computers and I've never heard of this i need some help, I may just be stupid but i seriously need some help here
    preferably instructions for a hp computer

    This looks to be an error with the web site you are visiting, not a problem with your PC.  I suggest you contact the web site owner.  The error suggests a problem with programming against a MySQL database, which is not a Microsoft technology.
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • 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);
    ?>

  • You have an error in your SQL syntax;

    i have a checkout page that i am trying to send to a payment centre but and 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 '16)' at line 1
    can someone help and tell me what this means does it mean "conflict with columns definitions"
    if so what can i do to solve the issue? do you need to see the page code?
    thanks

    <?php require_once('Connections/wibbles.php'); ?>
    <?php
    // do not cache
    header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");                      // Date in the past
    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
    header ("Cache-Control: no-cache, must-revalidate");                    // /1.1
    header ("Pragma: no-cache");                                            // /1.0
    // *** Restrict Access To Page: Grant or deny access to this page
    $FX_authorizedUsers=" ";
    $FX_authFailedURL="login.php";
    $FX_grantAccess=0;
    if (!session_id()) session_start();
    if (isset($_SESSION["MM_Username"])) {
      if (true || !(isset($_SESSION["MM_UserAuthorization"])) || $_SESSION["MM_UserAuthorization"]=="" || strpos($FX_authorizedUsers, $_SESSION["MM_UserAuthorization"])) {
        $FX_grantAccess = 1;
    if (!$FX_grantAccess) {
      $FX_qsChar = "?";
      if (strpos($FX_authFailedURL, "?")) $FX_qsChar = "&";
      $FX_referrer = "Restricted Area";
      $FX_authFailedURL = $FX_authFailedURL . $FX_qsChar . "accessdenied=" . urlencode($FX_referrer);
      header("Location: $FX_authFailedURL");
      exit;
    // *** Retrieve X ID ***
    if (!session_id()) session_start();
    $XC_OrderIdSessionVar = "OrderID";
    if (!isset($_SESSION[$XC_OrderIdSessionVar])) {
      // Get a unique OrderID number and save to session.
      $XC_tableName = "wibble_nextorder";
      $XC_fieldName = "NextOrderID";
      mysql_select_db($database_wibbles, $wibbles);
      $XC_IdSource = "select " . $XC_fieldName . " from " .  $XC_tableName;
      $XC_rsId = mysql_query($XC_IdSource, $wibbles) or die(mysql_error());
      $row_XC_rsId = mysql_fetch_assoc($XC_rsId);
      $_SESSION[$XC_OrderIdSessionVar] = $row_XC_rsId[$XC_fieldName];
      $$XC_OrderIdSessionVar = $_SESSION[$XC_OrderIdSessionVar];
      session_register($XC_OrderIdSessionVar);
      $XC_next = $_SESSION[$XC_OrderIdSessionVar] + 1;
      $XC_upd = "update " . $XC_tableName . " set " . $XC_fieldName . " = " . $XC_next;
      $XC_rsId = mysql_query($XC_upd, $wibbles) or die(mysql_error());
      $XC_rsId = null;
    // x limit validation
    if (isset($_POST["XC_Limit"]) && $_POST["XC_Limit"] != "") {
      $XC_limErr = stripslashes($_POST["XC_Limit"]);
      if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
      unset($HTTP_POST_VARS);
      unset($_POST);
    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;
    // x limit validation
    if (isset($_POST["XC_Limit"]) && $_POST["XC_Limit"] != "") {
      $XC_limErr = stripslashes($_POST["XC_Limit"]);
      if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
      unset($_POST);
      unset($_POST);
    // Validate X amount
    if (isset($_POST["XC_Amount"]) && $_POST["XC_Amount"] < 10) {
        if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
        unset($_POST);
        unset($_POST);
        $XC_amErr = "The amount doesn't reach the allowed minimum of &euro; 100.";
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 wibble_orders (OrderID, CustomerID, OrderDate, Shipping, Discount, Tax, Total) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['OrderID'], "int"),
                           GetSQLValueString($_POST['CustomerID'], "int"),
                           GetSQLValueString($_POST['OrderDate'], "date"),
                           GetSQLValueString($_POST['Shipping'], "double"),
                           GetSQLValueString($_POST['Discount'], "double"),
                           GetSQLValueString($_POST['Tax'], "double"),
                           GetSQLValueString($_POST['XC_Amount'], "double"));
      mysql_select_db($database_wibbles, $wibbles);
      $Result1 = mysql_query($insertSQL, $wibbles) or die(mysql_error());
    // *** X Shopping Cart ***
    $useSessions = true;
    $XCName = "wibbleJakeCart";
    $XCTimeout = 30;
    $XC_ColNames=array("ProductID","Quantity","Name","Color","Price","MinQty","Discount","Stoc k","Total");
    $XC_ComputedCols=array("","","","","","","","","Price");
    require_once('XCInc/XCart.inc');
    $colname_rsCustomer = "1";
    if (isset($_SESSION['MM_UserAuthorization'])) {
      $colname_rsCustomer = $_SESSION['MM_UserAuthorization'];
    mysql_select_db($database_wibbles, $wibbles);
    $query_rsCustomer = sprintf("SELECT * FROM wibble_customers WHERE CustomerID = %s", GetSQLValueString($colname_rsCustomer, "int"));
    $rsCustomer = mysql_query($query_rsCustomer, $wibbles) or die(mysql_error());
    $row_rsCustomer = mysql_fetch_assoc($rsCustomer);
    $totalRows_rsCustomer = mysql_num_rows($rsCustomer);
    // *** Redirect if XCart is Empty ***
    $XC_RedirectIfEmpty = "shopping-cart.php";
    if (isset($_SERVER["QUERY_STRING"])) {
      $XC_RedirectIfEmpty .= "?" . htmlentities($_SERVER["QUERY_STRING"]);
    if (isset(${$XCName}["contents"]) && (sizeof(${$XCName}["contents"][0]) == 0)) header("Location: " . $XC_RedirectIfEmpty);
    // *** Repeat XCart region *** (do not remove this label)
    // validate x limit
    $XC_invalidItems = "";
    $XC_lim = "";
    $iCol = array_search("Quantity",${$XCName}["ColNames"]);
    $iSrc = array_search("Stock",${$XCName}["ColNames"]);
    for ($iVal=0; $iVal<sizeof(${$XCName}["contents"][0]); $iVal++) {
      if (${$XCName}["contents"][$iCol][$iVal] > ${$XCName}["contents"][$iSrc][$iVal]) {
        if ($XC_invalidItems != "") $XC_invalidItems .= "-";
        $XC_invalidItems .= (string) ($iVal+1);
        if ($XC_lim != "") $XC_lim .= "-";
        $XC_lim .= (string) ${$XCName}["contents"][$iSrc][$iVal];
    if ($XC_invalidItems != "") {
      $XC_invalidItems = "(".$XC_invalidItems.")";
      $XC_lim = "(".$XC_lim.")";
      $x_limErr = "The item(s) $XC_invalidItems exceed the available stock of $XC_lim";
    // *** Add shipping based on Range
    mysql_select_db($database_wibbles, $wibbles);
    $XC_sourceVal = $XCart_sumTotal;
    $XC_ShipSource = "SELECT Shipping FROM wibble_shipbyprice WHERE MinPurchase < " . $XC_sourceVal . " AND MaxPurchase >= " . $XC_sourceVal;
    $XC_rsShip = mysql_query($XC_ShipSource, $wibbles) or die(mysql_error());
    $row_XC_rsShip = mysql_fetch_assoc($XC_rsShip);
    $XC_Shipping = $row_XC_rsShip['Shipping'];
    $XC_rsShip = null;
    // *** Add Referenced Sales Tax
    mysql_select_db($database_wibbles, $wibbles);
    $XC_taxSource = "SELECT Tax FROM wibble_tax WHERE Country = '" . $row_rsCustomer['Country'] . "'";
    $XC_rsTax = mysql_query($XC_taxSource, $wibbles) or die(mysql_error());
    $row_XC_rsTax = mysql_fetch_assoc($XC_rsTax);
    $XC_Tax = $row_XC_rsTax['Tax'];
    $XC_rsTax = null;
    $XC_SalesTax = $XC_Tax*($XCart_sumTotal+$XC_Shipping-$XC_Discount);
    // *** Compute Grand Total
    $XC_GranTotal = $XCart_sumTotal+$XC_SalesTax+$XC_Shipping-$XC_Discount;
    // *** Format table as Europe style
    if (!session_id()) session_start();
    // set header 
    $XC_header = "<style type=\"text/css\">\n<!--\n";
    $XC_header .= "table {font-family: Arial, Helvetica, sans-serif; font-size: 13px;}\n";
    $XC_header .= "-->\n</style>\n";
    $XC_header .= "<table width=\"520\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
    $XC_header .= "  <tr>\n    <td>\n";
    $XC_header .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
    $XC_header .= "  <tr>\n    <td> </td>\n    <td align=\"right\"> </td>\n  </tr>\n";
    $XC_header .= "  <tr>\n    <td>Order n. <b>" . $_SESSION["OrderID"] . "</b></td>\n    <td align=\"right\"> " . date("d/m/Y") . "</td>\n  </tr>\n";
    $XC_header .= "  <tr>\n    <td> </td>\n    <td> </td>\n  </tr>\n";
    $XC_header .= "  <tr>\n    <td colspan=\"2\" align=\"Left\">";
    $XC_header .= $row_rsCustomer["FirstName"] . " ";
    $XC_header .= $row_rsCustomer["LastName"] . " <br>";
    $XC_header .= $row_rsCustomer["Address"] . " <br>";
    $XC_header .= $row_rsCustomer["ZIP"] . " ";
    $XC_header .= $row_rsCustomer["City"] . " ";
    $XC_header .= $row_rsCustomer["State"] . " <br>";
    $XC_header .= $row_rsCustomer["Country"] . " <br>";
    $XC_header .= "</td>\n  </tr>\n</table>\n";
    $XC_header .= "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
    $XC_header .= "  <tr>\n    <td colspan=\"5\"> </td>\n  </tr>\n";
    $XC_header .= "  <tr>\n    <td colspan=\"5\">Cart contents: </td>\n  </tr>\n";
    // set cart data 
    $XCartData = "  <tr>\n";
    $XCartData .= "    <th width=\"30\" bgcolor=\"#CC6600\"><font color=\"white\">Qty</font></th>\n";
    $XCartData .= "    <th width=\"310\" bgcolor=\"#CC6600\"><font color=\"white\">Description</font></th>\n";
    $XCartData .= "    <th width=\"60\" bgcolor=\"#CC6600\"><font color=\"white\">Price</font></th>\n";
    $XCartData .= "    <th width=\"40\" bgcolor=\"#CC6600\"><font color=\"white\">Disc</font></th>\n";
    $XCartData .= "    <th width=\"80\" bgcolor=\"#CC6600\"><font color=\"white\">Total</font></th>\n";
    $XCartData .= "  </tr>\n";
    for ($jRow=0; $jRow<sizeof(${$XCName}["contents"][0]); $jRow++) {
      require('XCInc/RepeatXMailRegion.inc');
      $XCartData .= "  <tr>\n";
      $XCartData .= "    <td align=\"Center\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][1][$jRow] . "</td>\n";
      $XCartData .= "    <td align=\"Left\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][2][$jRow] . "</td>\n";
      $XCartData .= "    <td align=\"Right\" bgcolor=\"#FFFF99\">&euro; " . number_format(${$XCName}["contents"][4][$jRow], 2, ',', '.') . "</td>\n";
      $XCartData .= "    <td align=\"Center\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][6][$jRow] . "</td>\n";
      $XCartData .= "    <td align=\"Right\" bgcolor=\"#FFFF99\">&euro; " . number_format(${$XCName}["contents"][8][$jRow], 2, ',', '.') . "</td>\n";
      $XCartData .= "  </tr>\n";
    // set footer
    $XC_footer = "  <tr>\n    <td colspan=\"4\" align=\"right\"><b> SubTotal </b></td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"><b> &euro; " . number_format($XCart_sumTotal, 2, ',', '.') . "</b></td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"4\" align=\"right\"> Shipping </td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"> &euro; " . number_format($XC_Shipping, 2, ',', '.') . "</td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"4\" align=\"right\">  </td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"> </td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"4\" align=\"right\"> Sales Tax </td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"> &euro; " . number_format($XC_SalesTax, 2, ',', '.') . "</td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"4\" align=\"right\"><b> Grand Total </b></td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"><b> &euro; " . number_format($XC_GranTotal, 2, ',', '.') . "</b></td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"5\"> </td>\n  </tr>\n";
    $XC_footer .= "</table>\n    </td>\n  </tr>\n</table>\n";
    // join all
    if (isset($_SESSION["XC_CartMail"])) session_unregister("XC_CartMail");
    $XC_CartMail = $XC_header . $XCartData . $XC_footer;
    $_SESSION["XC_CartMail"] = $XC_CartMail;
    session_register("XC_CartMail");
    // *** Save XCart contents to table ***
    require_once('XCInc/XCsaveAction.inc');
    if (isset($_GET['XC_SaveCartToTable']) && ($_GET['XC_SaveCartToTable'] == "1")) {
      $XC_destColName = array("ProductID","Quantity","","Color","UnitPrice","","Discount","","Total");
      $XC_destColType = array("str","num","str","str","num","num","num","num","num");
      $XC_orderId = $_SESSION['OrderID'];
      $XC_tableName = "wibble_orderdetails";
      $XC_OrderIDCol = "OrderID";
      $XC_OrderIDType = "num";
      $XC_AddToTableRedirect = "thanks.php";
      $XC_conName = "wibbles";
      require_once('XCInc/SaveXCartToTable.inc');
    // clone a session
    if (!session_id()) session_start();
    if (isset($_SESSION["OrderNum"])) session_unregister("OrderNum");
    if (isset($_SESSION["OrderID"])) {
      $OrderNum = $_SESSION["OrderID"];
      $_SESSION["OrderNum"] = $OrderNum;
      session_register("OrderNum");
    function DoFormatCurrency($theObject,$NumDigitsAfterDecimal,$DecimalSeparator,$GroupDigits,$Curren cySymbol) {
              $currencyFormat=$CurrencySymbol.number_format($theObject,$NumDigitsAfterDecimal,$Dec imalSeparator,$GroupDigits);
              return ($currencyFormat);
    function DoFormatPercent($theObject,$NumDigitsAfterDecimal,$DecimalSeparator,$GroupDigits) {
              $currencyFormat=number_format($theObject*100,$NumDigitsAfterDecimal,$DecimalSeparato r,$GroupDigits).'%';
              return ($currencyFormat);
    ?>

  • Error when making connection:  You have an error in your SQL syntax;

    I'm getting this error when trying to make a simple Database Connection:
    SQLException: 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 '????????????????????????????????' at line 1
    SQLState: 42000
    VendorError: 1064
    I tried a different driver and got the same error with more "?"s in the "use near....." part.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class DBTest{         public static void main(String[] args){                 try{                         Class.forName("com.mysql.jdbc.Driver").newInstance();                 } catch(Exception e){                         System.out.println(e);                         System.exit(0);                 }                 Connection conn = null;                 try {                         conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testDB?" + "user=root&password=password");                         conn.close();                 } catch (SQLException ex) {                         // handle any errors                         System.out.println("SQLException: " + ex.getMessage());                         System.out.println("SQLState: " + ex.getSQLState());                         System.out.println("VendorError: " + ex.getErrorCode());                 }         } }
    MySQL Server Version:
    Server version: 5.0.67-0ubuntu6 (Ubuntu)

    cotton.m wrote:
    c0c0 wrote:
    I've tried Drivers 5.1 , 5.0 and 3.1 now and I get the same problem every time. I've tried switching databases, users, etc but always get this same error:
    java.sql.SQLException: 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 '????????????????' at line 1
    I have the latest version of mysql from the Ubuntu repositories. Do I have to configure that a certain way? It isn't the URL which I supply that it does not like because I've tried multiple URLs and they all give me the same error when I supply the correct information.
    Any help is greatly appreciated.This is.. very odd.
    I have to ask are you really, really sure that your code is just as you posted? Are you sure you aren't running a query of some sort? My guess at this point would be some sort of rather bizarre encoding issue. I'm sorry but I can't reproduce your behaviour, I am connecting to different MySQL instances with no problem from Ubuntu..
    Yes the code is exactly the same as what I posted (except hiding actual usernames and passwords)
    I've even tried to connect to a remote mysql server and get the same behavior (If I type in the wrong database it alerts me there is no db of that name, if I lg in with the wrong password it alerts me cant login ____ @ ______, when I have all the correct information I get that same old error) , I'm somewhat convinced it's my driver now. I thought at first it was the way I had mysql configured but now I think it's my driver or the way I have everything installed. I simply put the driver location in the classpath and do the command:
    export set CLASSPATH=/usr/share/tomcat5.5-webapps/ROOT/lib/mysql-connector-java-5.1.7-bin.jar
    Was this the wrong way to go about doing it? I'm not currently running tomcat I simply put it there because a book said that's where it should go for tomcat, but I wanted to first try this not running tomcat with just a simple normal Java example.

  • Error in your SQL syntax........near '' at line 1

    i have a payment success page that should update the database when a payment is correct but am getting the 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 '' at line 1
    on the success.php page, i have looked at the code but cant seem to see the error, i have changed the ' ' to "" on line one but that didn't do it so was hoping someone could look and see the incorrect syntax
    <?php require_once('Connections/chic.php'); ?>
    <?php
    // *** Update the stock ***
    $details_table = "chicJewls_orderdetails";
    $ID_column = "UniqueID";
    $details_prodID = "ProductID";
    $details_qty = "Quantity";
    $XStock_TableName = "chicJewls_products";
    $XStock_FieldName = "Stock";
    $XStock_unID = "ProductID";
    if (!session_id()) session_start();
    if (isset($_SESSION["orderID"])) {
      mysql_select_db($database_chic, $chic);
      $details_Source = "select * from " .  $details_table . " where " . $ID_column . " = " . $_SESSION["orderID"];
      $detailsRS = mysql_query($details_Source, $chic) or die(mysql_error());
      $row_detailsRS = mysql_fetch_assoc($detailsRS);
      do {
        $XStock_qtySource = "select " . $XStock_FieldName . " from " .  $XStock_TableName . " where " . $XStock_unID . " = " .$row_detailsRS[$details_prodID] . "";
        $XStock_rsUpd = mysql_query($XStock_qtySource, $chic) or die(mysql_error());
        $row_XStock_rsUpd = mysql_fetch_assoc($XStock_rsUpd);
        if ($row_XStock_rsUpd[$XStock_FieldName] > 0) {
          $XStock_new = $row_XStock_rsUpd[$XStock_FieldName] - $row_detailsRS[$details_qty];
          if ($XStock_new < 0) $XStock_new = 0;
          $XStock_UpdSource = "update " . $XStock_TableName . " set " . $XStock_FieldName . " = " . $XStock_new . " where " . $XStock_unID . " = " .$row_detailsRS[$details_prodID] . "";
          $XStock_rsUpd = mysql_query($XStock_UpdSource, $chic) or die(mysql_error());
      } while ($row_detailsRS = mysql_fetch_assoc($detailsRS));
      $XStock_rsUpd = null;
      $detailsRS = null;
      session_unregister("orderID");
    ?>
    thanks in advance

    No, I'm talking about the dot before.
    Change this
    .$row_detailsRS[$details_prodID] . "";
    to this
    . $row_detailsRS[$details_prodID] . "";
    in both places.

  • Error in your SQL syntax

    Getting this error when using DW CS3 Insert Record Wizard
    with CF8 and MySql 5
    quote:
    Error Executing Database Query.
    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 '"description") VALUES ( 'any' )' at line 1
    The error occurred in
    C:\ColdFusion8\wwwroot\mysqltest\untitled1.cfm: line 7
    5 : VALUES (<cfif IsDefined("FORM.description") AND
    #FORM.description# NEQ "">
    6 : <cfqueryparam value="#FORM.description#"
    cfsqltype="cf_sql_clob" maxlength="2147483647">
    7 : <cfelse>
    8 :
    9 : </cfif>
    SQLSTATE 42000
    SQL INSERT INTO testedmemo ("description") VALUES ( (param 1)
    VENDORERRORCODE 1064
    DATASOURCE test

    Try using backticks to escape the column name description.
    Try removing the hash signs around FORM.description.
    Edit: You can probably also omit the maxlength attribute in
    your queryparam.

  • ERROR 1064 (42000): You have an error in your SQL syntax;

    Folks,
    I stucked here while granting the permissions.
    could you please throw any ideas why this...
    mysql> GRANT SELECT, INSERT, DELETE ON database TO prod@localhost IDENTIFIED BY
    'Welcome1'
    -> FLUSH PRIVILEGES;
    ERROR 1064 (42000): 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 'datab
    ase TO prod@localhost IDENTIFIED BY 'Welcome1'
    FLUSH PRIVILEGES' at line 1
    mysql> \q

    wrong forum mate ! need to post in SQL forums

  • SQL Dev 2.1.63.73 Syntax Checking Issue

    Hi I just wanted to point out that the syntax checker routinely marks valid code as invalid (_with a wave red underline_). Sometimes simply adding a space somewhere in the code will make it go away temporarily, but it inevitably comes back.
    Here's some example code that exhibits the issue:
    --Fill in any trailing partial months with default assignments.
    merge into my_calendar dst
    using (select t1.my_sequence
                 , t1.shift_date+t2.rn shift_date
                 , CASE
                     WHEN TO_CHAR(t1.shift_date + t2.rn, 'Dy') IN ('Sat', 'Sun')
                     THEN 'Off'
                     ELSE 'Day'
                   END shift
                 , t1.location_key
                 , 'Generated' assignment
              from (select my_sequence
                         , location_key
                         , max(shift_date) shift_date
                         , TRUNC(trunc(MAX(oc.s_date),'mm') + NUMTOYMINTERVAL(1, 'month'), 'mm')
                           - MAX(shift_date) ddiff
                      from my_calendar
                     group by my_sequence, location_key
                    having max(shift_date) < to_date('1-jul-2010')
                    ) t1
              join (SELECT rownum rn
                      FROM my_calendar
                   ) t2
                 on t2.rn < t1.ddiff) src
       on (src.my_sequence = dst.my_sequence and
           src.shift_date = dst.shift_date)
      when matched then
        update set dst.shift = case when src.assignment != 'Generated' then src.shift else dst.shift end
      when not matched then
        insert (dst.my_sequence, dst.shift_date, dst.shift, dst.location_key)
        values (src.my_sequence, src.shift_date, src.shift, src.location_key);This is a rather extreme example, but nearly the entire SQL code while valid and performing as expected is still marked as having invalid syntax.
    Hopefully this will be resolved in the next version.

    I agree. Do you know of any way to turn it off completely? I think it is causing some performance problems while typing in a worksheet or directly into a procedure/function.

  • Sql syntax in jsp

    Hey All!
    Im trying ot use a a bean to select data from a table where email != ''
    The funny thing is my code works in one couple of jsp/bean but not in another, even though it's the exact same code.
    This works
    The Bean:
    String sql = "SELECT applicantid, firstname, lastname, dob, " +
    "homestreet, homestate, homecity, homezip, " +
    "email, college, major, standing, " +
    "graddate, schstreet, schcity, schstate, " +
    "schzip, schphone, resOne, resTwo, " +
    "resThree, waiver, bioletter, password, " +
    "homephone " +
    "FROM apptest " +
    "WHERE " + filter + " " +
    "ORDER BY " + orderBy;
    The filter is the String "email != ''" and orderBy ="lastname"
    Works perfectly!
    But when I use similar code for another table
    Code:
    String sql = "SELECT providerid, applicantid, pin, title, " +
    "company, firstname, lastname, phone, " +
    "email, recletter " +
    "FROM provtest " +
    "WHERE " + filter + " " +
    "ORDER BY " + orderBy;
    with filter as "email != '' " and orderBy = "lastname"
    I get the following error:
    Error in findRecords ProviderUtility(Syntax error or access violation, message from server: "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 '' at line 1")
    Keep in mind that email != '' (these are single quotes)
    I am really baffled.
    Ike

    "The funny thing is my code works in one couple of jsp/bean but not in another, even though it's the exact same code."
    If it's EXACTLY the same code, what did you need another bean for?
    If you needed a new bean, then it's not exactly the same.
    Why aren't you using PreparedStatement to escape strings and dates for you?
    Believe the engine when it tells you there's a mistake.
    %

  • Parse sql syntax

    I have temp table inside my stored procedure:
    CREATE TABLE #tmpOrders(product_id VARCHAR(20))
    SELECT * FROM #tmpOrders o INNER JOIN dbo.products p ON o.productID=p.productID
    o.productID column doesn't exists. The join should be:
    ON o.product_id=p.productID
    But when I create procedure, parser doesn't raise an error. The error is raised at run time.
    Is there some option to check the SQL syntax before run time - to parse also temp table names?
    Thanks,
    Simon

    Hi Simon
    See my latest replay... I create a temporary table and then run CREATE PROCEDURE script to get the error, that was a mistake
    CREATE TABLE #t (c int)
    CREATE PROCEDURE sp1
    AS
    CREATE TABLE #t (c int)
    SELECT * FROM #t JOIN sys.objects o on #t.c1=o.object_id
    Msg 207, Level 16, State 1, Procedure sp1, Line 6
    Invalid column name 'c1'.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for

  • ITunes Store Crashes Windows 8.1 | QTMovieWin.dll fix did NOT work

    I am running iTunes 11.1.3 on Windows 8.1 64 bit. iTunes and the iTunes Store worked prior to my upgrade to from Windows 8 to 8.1. Every time I attempt to access the iTunes Store or anything associated with it, iTunes crashes. I have tried the QTMovi

  • Regarding BW performance

    I built a new BW system with BI-Content 7.04. When activate BI content, it usually got a runtime out  error. I has changed parameter: icm/conn_timeout value I read lots of document about performance, but too much information. So anybody can tell me w

  • Computer Freezes with X

    I got my X-Fi Xtrememusic a few days ago. I installed it and it worked wonderfully. Today, my computer started freezing. I would play Battlefield 2 for about 20 minutes and it seemed fine, then all of a sudden it would just freeze and the sound would

  • How to set a business partner as a key user in service desk?

    Can anybody tell me how to do so? Best regards,

  • X-Fi questi

    Just a couple of questions. What would be considered the "best" X-Fi soundcard available? I would assume it's the Elite Pro, since it's the most expensi've and all. Are there any major problems with the Elite Pro that would deter me from buying it's?