In MySQL, the statement below works:
mysql>insert into emp1(empno,empname,empsal,empcity) values (100,'vinay',10000,'USA');**
mysql> select * from emp1;
+-------+---------+--------+---------+
| empno | empname | empsal | empcity |
+-------+---------+--------+---------+
| 100 | vinay | 10000 | USA |
+-------+---------+--------+---------+
In Oracle, the statement below works:
mysql> insert into emp1 values(&empno,'&empname',&empsal,'&empcity');**
But this doesn't work in MySQL - why can't the values be prepended by &
?
Am assuming the ampersands are for SQL*Plus substitution variables.
These are supported by Oracle but not by MySQL.
Similar code for MySQL is like this:
SET @empno = 100, @empname = 'vinay', @empsal = 10000, @empcity = 'USA';
insert into emp1 values(@empno,@empname,@empsal,@empcity);
Note the @
, no '
in the INSERT
values, etc.
If you are translating between different DBMS systems, you should plan on significant rewriting. This is just one of hundreds of differences between Oracle and MySQL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With