i have a ms sql select statement and i want to write it in oracle pl/sql select statement is there any tool to do that
Three answers:
TheMadProfessor
2010-12-06 10:20:59 UTC
As long as you use standard SQL, no conversion should be necessary. It's only if you use extensions and functions that they differ (TOP in SQL Server, LIMIT in Oracle, etc.) Try a Google search on "sql server oracle conversion" - there seem to be at least a few companies offering such a migration tool.
John S
2010-12-09 21:55:26 UTC
The syntax is slightly different if yoiu're embedding select statements in pl/sql - you either need to to ad an INTO clause to copy the results into PL/SQL variables or declare a cursor or use a cursor FOR LOOP. The othe rthing to be aware of is that pl/sql vraibles will only hold 1 value unless you declare them as PL/SQL tables, so you could get a TOO-MANY-ROWS exception
eg
declare
id employees.employee_id%type;
firstname employees.first_name%type;
begin
SELECT employee_id,first_name INTO id,firstname FROM employees WHERE rownum=1;
FOR emp_rec in (SELECT employee_id,first_name INTO id,firstname FROM employees ) LOOP
end loop;
end;
For tutorials on Oracle, SQL and PL/SQL see http://www.asktheoracle.net
buffy
2016-06-02 07:35:23 UTC
Can you at least TRY, and then ask for some help? Show us what you've done so far, and we can help you. For instance, 1) can not be answered by anyone else because we don't know the structure of the table, or the names of the tables. The same is true with 2), because we don't know the structure of the table. And likewise for 3, 4, 5, etc.
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.