-1

I am getting an error while declaring a varchar in MySQL 5.0.77:

DECLARE city varchar(20);

The above line of code works fine in an Oracle database, but not in MySQL. Can someone suggest a solution? I saw a similar question on this site, but could not find a suitable answer.

One more question: %ROWTYPE and %TYPE are these declarations there in MYSQL?

Leigh
  • 28,765
  • 10
  • 55
  • 103
Vivek Sharma
  • 2,667
  • 2
  • 15
  • 8
  • 1
    [DECLARE WHILE outside stored procedure how?](http://stackoverflow.com/questions/12954095/mysql-declare-while-outside-stored-procedure-how/12954385#12954385). – Devart Oct 30 '12 at 11:28

1 Answers1

0

Per the MySQL docs DECLARE works only at the start of a BEGIN...END block as in a stored program.

DECLARE city as VARCHAR(20); in mysql will be correct
are you asking about session variables in mysql like this SET @var := 1 then the answer is yes

Arun Killu
  • 13,581
  • 5
  • 34
  • 61