Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2013
    Posts
    6

    Unanswered: Declaring and Setting Variables

    I've been given a connection to a MySQL database on a Linux server - the version appears to be 5.1.52. I'm able to run "select" statements with no problem. I think everything has to be in lower case. I'm trying to create variables and getting an error: "Fatal error encountered during command execution." Each of the following statements, for example, will yield the error:

    Code:
    set @t1=1;
    
    set @t3:=4;
    
    select @t1=1;
    
    select @t3:=4;

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    According to MySQL :: MySQL 5.1 Reference Manual :: 9.4 User-Defined Variables the colon equals ought to be just a plain equals.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Feb 2013
    Posts
    6
    Quote Originally Posted by Pat Phelan View Post
    According to MySQL :: MySQL 5.1 Reference Manual :: 9.4 User-Defined Variables the colon equals ought to be just a plain equals.

    -PatP
    But my examples above are from the page you quote.

  4. #4
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    Where are you running this from? Are you using the command line program mysql or some other application?
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  5. #5
    Join Date
    Feb 2013
    Posts
    6
    Quote Originally Posted by it-iss.com View Post
    Where are you running this from? Are you using the command line program mysql or some other application?
    I'm using "some other application" - Logi Info. I know my access rights to the database are limited to read-only. I just tried creating a temp table and it told me I didn't have rights - so I wonder if I don't have rights to create variables, since I'm using common examples which should ordinarily work. I wonder if defining variables is something you have to be granted special rights to do.

    I can work around the problem by copying the entire MySQL table into an MS SQL database, where I'm allowed to define variables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •