Home » SQL & PL/SQL » SQL & PL/SQL » Re: mySQL select statement
Re: mySQL select statement [message #252752] Thu, 19 July 2007 21:05 Go to next message
npadilla
Messages: 9
Registered: July 2007
Junior Member
can anyone convert this to a pl/sql statement?

SELECT DISTINCT
tbl_batch_step_tool_user_submit.fld_id,
tbl_batch.fld_batch_id AS BatchID,
tbl_batch.fld_name AS `Batch Name`,
tbl_step.fld_name AS Step,
tbl_user.fld_name AS `User Name`,
tbl_user.fld_user_id AS UserID,
tbl_step.fld_step_id,
tbl_batch_step_tool_user_submit.fld_date AS `Date Append`
FROM tbl_batch INNER JOIN tbl_batch_step_tool_user_submit
ON tbl_batch.fld_batch_id =tbl_batch_step_tool_user_submit.fld_batch_id
INNER JOIN tbl_step
ON tbl_batch_step_tool_user_submit.fld_step_id=tbl_step.fld_step_id
INNER JOIN tbl_user
ON tbl_batch_step_tool_user_submit.fld_user_id=tbl_user.fld_user_id
WHERE tbl_batch.fld_ver_id=', "'",ver_id, "'
AND (", where_clause, ' || 'SUBSTR(fld_step_string_series,', var_step,',1) =3
AND tbl_batch_step_tool_user_submit.fld_date< DATE_SUB(NOW(), INTERVAL 2 DAY);');

Re: mySQL select statement [message #252759 is a reply to message #252752] Thu, 19 July 2007 21:36 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>can anyone convert this to a pl/sql statement?
HUH?
Valid SQL is valid within PL/SQL.
There is NOTHING to "convert".
Besides if you can solve a problem using SQL, you should NOT solve it using PL/SQL.
Re: mySQL select statement [message #252761 is a reply to message #252752] Thu, 19 July 2007 22:01 Go to previous messageGo to next message
npadilla
Messages: 9
Registered: July 2007
Junior Member
you mean to say this sql statement is a valid pl/sql statement?
Re: mySQL select statement [message #252765 is a reply to message #252752] Thu, 19 July 2007 22:25 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>you mean to say this sql statement is a valid pl/sql statement?
Yes, as the basis for a cursor or by the addition of the INTO clause.

Based upon your asking this question, I suspect that you never read the fine PL/SQL reference manual.

You're On Your Own (YOYO)!
Re: mySQL select statement [message #252791 is a reply to message #252765] Fri, 20 July 2007 00:45 Go to previous messageGo to next message
skooman
Messages: 913
Registered: March 2005
Location: Netherlands
Senior Member
Eeeh, strictly speaking, this SQL is not valid as far as I can see. For example the aliases like "AS USER NAME" will not work. Furthermore, something weird is happening in the where clause:
WHERE  tbl_batch.fld_ver_id = ', "' ",ver_id, "
 ' 
AND (", where_clause, ' || 'SUBSTR(fld_step_string_series,', var_step,
 ',1) =3 
AND tbl_batch_step_tool_user_submit.fld_date< DATE_SUB(NOW(), INTERVAL 2 DAY);');

Not sure, but maybe something interactive is meant here? Npadilla, we will need to know what you are trying to accomplish in order to help you. Why do you feel this needs to be "converted" to PL/SQL? What are you trying to do?
Re: mySQL select statement [message #252795 is a reply to message #252761] Fri, 20 July 2007 00:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
As in your previous topic you confuse.
PL/SQL is not Oracle SQL.
It is Oracle Programming Language on SQL.

Regards
Michel
Re: mySQL select statement [message #252801 is a reply to message #252791] Fri, 20 July 2007 01:10 Go to previous messageGo to next message
npadilla
Messages: 9
Registered: July 2007
Junior Member
Im sorry...
WHat I meant was Oracle PL
Re: mySQL select statement [message #252803 is a reply to message #252791] Fri, 20 July 2007 01:12 Go to previous messageGo to next message
npadilla
Messages: 9
Registered: July 2007
Junior Member
skooman...

We were given sotred procs that were written in mySQL and we need to convert those programs that could be read in Oracle 10g

Im really not familiar with mySQL that is why im seeking help from you guys... This is indeed a learning experience for me

Hope to hear from u soon
Re: mySQL select statement [message #252808 is a reply to message #252803] Fri, 20 July 2007 01:21 Go to previous messageGo to next message
skooman
Messages: 913
Registered: March 2005
Location: Netherlands
Senior Member
You state you don't know about MySQL, but to be honest, your knowledge of (Oracle) SQL doesn't seem to be enormous neither. I would suggest reading the manuals first or follow a training, before trying to convert any code.
No offense meant here, honestly trying to help you.
Re: mySQL select statement [message #252811 is a reply to message #252752] Fri, 20 July 2007 01:26 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Im really not familiar with mySQL that is why im seeking help from you guys... This is indeed a learning experience for me
You admit you don't know MYSQL it appears you don't know PLSQL,
so what in the @##$$%^&*() do you know?
Previous Topic: Problem with Fetching the data to table
Next Topic: How to do merge report in SQL
Goto Forum:
  


Current Time: Thu Dec 05 15:30:25 CST 2024