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/

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

  • Dynamic SQL from within DML - merging syntax issue #2

    Further to my previous thread on a SQL - DML merging syntax issue, I have another problem with multiple conditions in the WHERE-clause:
    vrb _retval decimal
    vrb _val1 text
    vrb _val2 text
    _val1 = 'value1'
    _val2 = 'value2'
    SQL SELECT DIM1_ATTR1 FROM MYSCHEMA.DIM1_DIM WHERE COL1 = :_val1, AND COL2 = :_val2, INTO :_retval
    The above SQL will return NA. If I use the text literals instead of the OLAP variables, the query just runs fine. Also, with a single condition (on COL1 only) the query returns the expected value.
    A note in the help states that OLAP DML objects should clearly be sperated from the rest of the SQL but does not say how. I am using a colon before and a comma after as without them the line would not compile. I could not find any example that would use multiple conditions in the WHERE-clause however the help text indicates that it is possible.
    Please help me, how.
    Regards,
    Csaba
    Windows, Oracle10gRel2 Ver. 10.2.0.1.0 eversion: 84090

    It does work, although I applied the finishing touch by removing the commas as well!
    Thanks a lot! Good job!
    Could you please have a look at issue #1 too? :-)
    Regards,
    Csaba

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

  • Oracle access sql syntax

    Hi,
    I am migrating access database to oracle 9i. Do you know of any changes to access sql syntax for it to use oracle backend?

    Very general question. It of course depends on the SQL you use. They are not 100% compatibile. The workbench will create the necessary link tables on your behalf, but you may need to update the SQL in you Access application code. Also you might have to tune your access application to work better in a client/server mode, e.g. if you where doing a join of two tables you would want that to occur on the server not on the client. This depends how you interface/bypass the jet engine. These issues are common whether the backend is Oracle or SQL Server for that matter.
    This should become obvious during your testing.
    Donal

  • SQL Performance issue: Using user defined function with group by

    Hi Everyone,
    im new here and I really could need some help on a weird performance issue. I hope this is the right topic for SQL performance issues.
    Well ok, i create a function for converting a date from timezone GMT to a specified timzeone.
    CREATE OR REPLACE FUNCTION I3S_REP_1.fnc_user_rep_date_to_local (date_in IN date, tz_name_in IN VARCHAR2) RETURN date
    IS
    tz_name VARCHAR2(100);
    date_out date;
    BEGIN
    SELECT
    to_date(to_char(cast(from_tz(cast( date_in AS TIMESTAMP),'GMT')AT
    TIME ZONE (tz_name_in) AS DATE),'dd-mm-yyyy hh24:mi:ss'),'dd-mm-yyyy hh24:mi:ss')
    INTO date_out
    FROM dual;
    RETURN date_out;
    END fnc_user_rep_date_to_local;The following statement is just an example, the real statement is much more complex. So I select some date values from a table and aggregate a little.
    select
    stp_end_stamp,
    count(*) noi
    from step
    where
    stp_end_stamp
    BETWEEN
    to_date('23-05-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')      
    AND
    to_date('23-07-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')
    group by
    stp_end_stampThis statement selects ~70000 rows and needs ~ 70ms
    If i use the function it selects the same number of rows ;-) and takes ~ 4 sec ...
    select
    fnc_user_rep_date_to_local(stp_end_stamp,'Europe/Berlin'),
    count(*) noi
    from step
    where
    stp_end_stamp
    BETWEEN
    to_date('23-05-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')      
    AND
    to_date('23-07-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')
    group by
    fnc_user_rep_date_to_local(stp_end_stamp,'Europe/Berlin')I understand that the DB has to execute the function for each row.
    But if I execute the following statement, it takes only ~90ms ...
    select
    fnc_user_rep_date_to_gmt(stp_end_stamp,'Europe/Berlin','ny21654'),
    noi
    from
    select
    stp_end_stamp,
    count(*) noi
    from step
    where
    stp_end_stamp
    BETWEEN
    to_date('23-05-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')      
    AND
    to_date('23-07-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')
    group by
    stp_end_stamp
    )The execution plan for all three statements is EXACTLY the same!!!
    Usually i would say, that I use the third statement and the world is in order. BUT I'm working on a BI project with a tool called Business Objects and it generates SQL, so my hands are bound and I can't make this tool to generate the SQL as a subselect.
    My questions are:
    Why is the second statement sooo much slower than the third?
    and
    Howcan I force the optimizer to do whatever he is doing to make the third statement so fast?
    I would really appreciate some help on this really weird issue.
    Thanks in advance,
    Andi

    Hi,
    The execution plan for all three statements is EXACTLY the same!!!Not exactly. Plans are the same - true. They uses slightly different approach to call function. See:
    drop table t cascade constraints purge;
    create table t as select mod(rownum,10) id, cast('x' as char(500)) pad from dual connect by level <= 10000;
    exec dbms_stats.gather_table_stats(user, 't');
    create or replace function test_fnc(p_int number) return number is
    begin
        return trunc(p_int);
    end;
    explain plan for select id from t group by id;
    select * from table(dbms_xplan.display(null,null,'advanced'));
    explain plan for select test_fnc(id) from t group by test_fnc(id);
    select * from table(dbms_xplan.display(null,null,'advanced'));
    explain plan for select test_fnc(id) from (select id from t group by id);
    select * from table(dbms_xplan.display(null,null,'advanced'));Output:
    PLAN_TABLE_OUTPUT
    Plan hash value: 47235625
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   1 |  HASH GROUP BY     |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   2 |   TABLE ACCESS FULL| T    | 10000 | 30000 |   159   (1)| 00:00:02 |
    Query Block Name / Object Alias (identified by operation id):
       1 - SEL$1
       2 - SEL$1 / T@SEL$1
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$1" "T"@"SEL$1")
          OUTLINE_LEAF(@"SEL$1")
          ALL_ROWS
          OPTIMIZER_FEATURES_ENABLE('10.2.0.4')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
    Column Projection Information (identified by operation id):
       1 - (#keys=1) "ID"[NUMBER,22]
       2 - "ID"[NUMBER,22]
    34 rows selected.
    SQL>
    Explained.
    SQL>
    PLAN_TABLE_OUTPUT
    Plan hash value: 47235625
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   1 |  HASH GROUP BY     |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   2 |   TABLE ACCESS FULL| T    | 10000 | 30000 |   159   (1)| 00:00:02 |
    Query Block Name / Object Alias (identified by operation id):
       1 - SEL$1
       2 - SEL$1 / T@SEL$1
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$1" "T"@"SEL$1")
          OUTLINE_LEAF(@"SEL$1")
          ALL_ROWS
          OPTIMIZER_FEATURES_ENABLE('10.2.0.4')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
    Column Projection Information (identified by operation id):
       1 - (#keys=1) "TEST_FNC"("ID")[22]
       2 - "ID"[NUMBER,22]
    34 rows selected.
    SQL>
    Explained.
    SQL> select * from table(dbms_xplan.display(null,null,'advanced'));
    PLAN_TABLE_OUTPUT
    Plan hash value: 47235625
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   1 |  HASH GROUP BY     |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   2 |   TABLE ACCESS FULL| T    | 10000 | 30000 |   159   (1)| 00:00:02 |
    Query Block Name / Object Alias (identified by operation id):
       1 - SEL$F5BB74E1
       2 - SEL$F5BB74E1 / T@SEL$2
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$F5BB74E1" "T"@"SEL$2")
          OUTLINE(@"SEL$2")
          OUTLINE(@"SEL$1")
          MERGE(@"SEL$2")
          OUTLINE_LEAF(@"SEL$F5BB74E1")
          ALL_ROWS
          OPTIMIZER_FEATURES_ENABLE('10.2.0.4')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
    Column Projection Information (identified by operation id):
       1 - (#keys=1) "ID"[NUMBER,22]
       2 - "ID"[NUMBER,22]
    37 rows selected.

  • How to track the sql commands issued against database

    Hello, We are using an interface developed by oracle forms. Its giving some error while pressing an icon. I can not able to trace out from where it arises. This error is displayed by form developed by oracle forms. I dont have source code to track it. I would like to know , which SQL statement rises the error, so that I can update the oracle object and can able to solve the problem if I can able to find the exect SQL statment issued before the error was displayed. kindly help me . thanks.

    habfat wrote:
    Hello, We are using an interface developed by oracle forms. Its giving some error while pressing an icon. I can not able to trace out from where it arises. This error is displayed by form developed by oracle forms. I dont have source code to track it. I would like to know , which SQL statement rises the error, so that I can update the oracle object and can able to solve the problem if I can able to find the exect SQL statment issued before the error was displayed. kindly help me . thanks.Hmm, well kind of a silly but still, if you don't have source code of the form( you said so) so even if you would come to know what statement is raising the error, how would you go and edit it ? Did I miss some thing? And you asked for a sql statement ? How did you come to know that its a sql statement that is causing the error? And if that's actually a sql statement error, isn't it associated with a meaningful message ?
    Find the developer who coded the application, he would be the best person to track the error and tell you its resolution IMO.
    HTH
    Aman....

  • PL/SQL speed issues when using a variable

    I have a very strange issue that is causing problems.
    I am running Golden connecting to a 11g database.
    I created a procedure to insert records into a table based on a query. The source query includes variables that I have populated prior to the insert statement. The problem is that if I use the variable for one very specific where statement, the statement goes from running in less than 1 second, to running in 15 minutes. It gets even more strange though. Not only does a 2nd variable not cause any problems, the exact same variable in the same statement works fine.
    This procedure takes 15 minutes to run.
    declare
        v_start_period date;
        v_end_period date;
    begin
        select add_months(trunc(sysdate,'mm'), -1), trunc(sysdate,'mm')
        into v_start_period, v_end_period
        from dual;
        insert into RESULTS_TABLE
                (first_audit_date, last_audit_date,
                data_column1, data_column2, data_column3)
            select
                a.first_audit_date, a.last_audit_date,
                b.data_column1, b.data_column2, b.data_column3
            from
                SOURCE_TABLE_1 b,
                (select marker_id, min(action_time) as first_audit_date, max(action_time) as last_audit_date
                    from SOURCE_TABLE_2
                    where action_time >= v_start_period and action_time < v_end_period
                    group by marker_id) a
            where b.marker_id = a.marker_id
                and exists (select 1 from SOURCE_TABLE_2
                    where marker_id = b.marker_id
                    and action_time >= v_start_period and action_time < v_end_period
                    and action_type = 'XYZ');
        commit;
    end;This procedure runs in less than 1 second, yet returns the exact same results.
    declare
        v_start_period date;
        v_end_period date;
    begin
        select add_months(trunc(sysdate,'mm'), -1), trunc(sysdate,'mm')
        into v_start_period, v_end_period
        from dual;
        insert into RESULTS_TABLE
                (first_audit_date, last_audit_date,
                data_column1, data_column2, data_column3)
            select
                a.first_audit_date, a.last_audit_date,
                b.data_column1, b.data_column2, b.data_column3
            from
                SOURCE_TABLE_1 b,
                (select marker_id, min(action_time) as first_audit_date, max(action_time) as last_audit_date
                    from SOURCE_TABLE_2
                    where action_time >= v_start_period and action_time < trunc(sysdate,'mm')
                    group by marker_id) a
            where b.marker_id = a.marker_id
                and exists (select 1 from SOURCE_TABLE_2
                    where marker_id = b.marker_id
                    and action_time >= v_start_period and action_time < v_end_period
                    and action_type = 'XYZ');
        commit;
    end;The only difference between the two is where I replace the first v_end_period variable with trunc(sysdate,'mm').
    I've been googling for possible solutions and keep running into something called "parameter sniffing". It appears to be a SQL Server issue though, as I cannot find solutions for Oracle. I tried nesting the insert statement inside it's own procedure with new variables populated by the old variables, but nothing changed.
    Edited by: user_7000017 on Jan 8, 2013 9:45 AM
    Edited by: user_7000017 on Jan 8, 2013 9:52 AM Put the code in code tags.

    You are not describing procedures. You are listing anonymous PL/SQL blocks.
    As for the code - this approach to assigning PL/SQL variables are highly questionable. As the functions are native PL/SQL functions too, there is no need to parse and execute a SQL cursor, do context switching, in order to assign values to PL/SQL variables.
    This is wrong:
    select
        add_months(trunc(sysdate,'mm'), -1), trunc(sysdate,'mm')
        into v_start_period, v_end_period
    from dual;This is correct:
    v_start_period := add_months(trunc(sysdate,'mm'), -1);
    v_end_period := trunc(sysdate,'mm');Just as you would not use +"select 1 into plVariable from dual;+", instead of a standard variable assignment statement like +"plVariable := 1;"+.
    As for the performance/execution difference. Does not make sense. I suggest simplifying the code in order to isolate the problem. For example, take that in-line SQL (aliased as a in the main SQL) and create a testcase where it uses the function, versus a PL/SQL bind variable with the same data type and value as that returned by the function. Examine and compare the execution plans.
    Increase complexity (if no error) and repeat. Until the error is isolated.
    The 1st step in any troubleshooting, is IDENTIFYING the problem. Without knowing what the problem is, how can one fix it?

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

  • Oracle 11g - External Table/SQL Developer Issue?

    Oracle 11g - External Table/SQL Developer Issue?
    ==============================
    I hope this is the right forum for this issue, if not let me, where to go.
    We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
    We are trying to use oracle external table to load text files in .csv format. Here is our data look like.
    ======================
    Date1,date2,Political party,Name, ROLE
    20-Jan-66,22-Nov-69,Democratic,"John ", MMM
    22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
    20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
    9-Aug-72,20-Jan-75,Republican,Henry,MMM
    ------ ALL NULL -- record
    20-Jan-80,20-Jan-89,Democratic,"Donald Smith",MMM
    ======================
    Our Expernal table structures is as follows
    CREATE TABLE P_LOAD
    DATE1 VARCHAR2(10),
    DATE2 VARCHAR2(10),
    POL_PRTY VARCHAR2(30),
    P_NAME VARCHAR2(30),
    P_ROLE VARCHAR2(5)
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY P_EXT_TAB_D
    ACCESS PARAMETERS (
    RECORDS DELIMITED by NEWLINE
    SKIP 1
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
    REJECT ROWS WITH ALL NULL FIELDS
    MISSING FIELD VALUES ARE NULL
    DATE1 CHAR (10) Terminated by "," ,
    DATE2 CHAR (10) Terminated by "," ,
    POL_PRTY CHAR (30) Terminated by "," ,
    P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
    P_ROLE CHAR (5) Terminated by ","
    LOCATION ('Input.dat')
    REJECT LIMIT UNLIMITED;
         It created successfully using SQL Developer
    Here is the issue.
    It is not loading the records, where fields are enclosed in '"' (Rec # 2,3,4,7)
    It is loading all NULL value record (Rec # 6)     
    *** If we remove the '"' from input data, it loads all records including all NULL records
    Log file has
    KUP-04021: field formatting error for field P_NAME
    KUP-04036: second enclosing delimiter not found
    KUP-04101: record 2 rejected in file ....
    Our questions
    Why did "REJECT ROWS WITH ALL NULL FIELDS" not working?
    Why did Terminated by "," OPTIONALLY ENCLOSED BY '"' not working?
    Any idea?
    Thanks in helping.

    I don't think this is a SQLDeveloper issue. You will get better answers in the Database - General or perhaps SQL and PL/SQL forums.

  • 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

  • ANSI SQL Syntax - What belongs to join-clause and what to where-clause

    Hello,
    we currently have a discussion about the ANSI SQL Syntax where we do not agree what belongs to the join clause and what belongs to the where clause in an ANSI Sytnax SQL Query.
    Lets say there is a query like this:
    +SELECT *+
    FROM employees emp, departments dept
    WHERE emp.dept_country = dept.dept_country
    AND emp.dept_name = dept.dept_name
    AND dept.dept_type = 'HQ'
    AND emp.emp_lastname = 'Smith'
    Primary key of the departments table is on the columns dept_country, dept_name and dept_type. We have a Oracle database 10g.
    Now I have rewritten the query to Ansi Syntax:
    +SELECT *+
    FROM employees emp
    JOIN departments dept
    ON emp.dept_country = dept.dept_country AND emp.dept_name = dept.dept_name
    WHERE dept.dept_type = 'HQ'
    AND emp.emp_lastname = 'Smith'
    Another developer says that this is not completely correct, every filter on a column that belongs to the primary-key of the joined table has to be in the join clause, like this:
    +SELECT *+
    FROM employees emp
    JOIN departments dept
    +ON emp.dept_country = dept.dept_country AND emp.dept_name = dept.dept_name AND dept.dept_type = 'HQ'
    WHERE emp.emp_lastname = 'Smith'
    Can somebody tell me which on is correct?
    Is there any definition for that? I couldn't find it in the Oracle Database definition.
    I just found out the names of the ANSI documents here: http://docs.oracle.com/cd/B19306_01/server.102/b14200/ap_standard_sql001.htm#i11939
    I had a look at the ANSI webstore but there you have to buy the PDF files. In my case thats exaggerated because both of the Queries work and i am just interessted if there is one correct way.
    Thank you in advance
    Marco

    Hi,
    As i guideline i would say, answer the question: should the result of the join be filtered or should only filtered rows be joined from a particular table?
    This is helpful in the case of outer joins also, for inner joins it doesnt matters as said already be former posters, where there may be hughe semantical differences depending of where the predicates are placed.
    From performance view, if we talk about oracle, take a look a the execution plans. You will see that there is (probably) no difference in case of inner joins. Even in case of outer joins the optimizer pushes the predicate as a filter towards the table if it semantically possible.
    Regards

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

Maybe you are looking for