php_beginner — 2012-10-17T21:19:03-04:00 — #1
Good day for all,
I have used MySQL database for my previous projects but now I need to try some on oracle.
At the beginner to the Oracle, I decide to familiarize myself with oracle by testing my previous projects in Oracle instead of MySQL.
I have the select statement here in the 'try' block which I have used in the java bean.
Here's the code:
String strQry = "SELECT T_STAFF*, T_DEPARTMENT.CODE, T_ROLE.CODE, T_STATUS.CODE, ";
strQry += "T_DEPARTMENT.DESCRIPTION, T_ROLE.DESCRIPTION, T_STATUS.DESCRIPTION ";
strQry += "FROM T_DEPARTMENT, T_ROLE, T_STATUS, T_STAFF ";
strQry += "WHERE STAFF_NAME = '"+strUserName+"' ";
strQry += "AND T_STAFF.STAFF_DEPARTMENT_OBJECTID = T_DEPARTMENT.OBJECTID ";
strQry += "AND T_STAFF.STAFF_ROLE_OBJECTID = T_ROLE.OBJECTID ";
strQry += "AND T_STAFF.STAFF_STATUS_OBJECTID = T_STATUS.OBJECTID ";
rs = stmt.executeQuery(strQry);
I need to know, can I use the same string above for Oracle? If no, how should the string look like?
Thanks in advance.
r937 — 2012-10-17T22:26:46-04:00 — #2
except for this asterisk here --
SELECT T_STAFF<font color='"#FF0000"'>*</font>, ...
that's gonna barf in every database system, including mysql
also, you should really learn JOIN syntax, and stop using the deprecated comma list style joins
php_beginner — 2012-10-17T22:46:37-04:00 — #3
Sorry, my mistake. it should be SELECT T_STAFF.*
Thanks for the explanation.
kylewolfe — 2012-10-18T13:20:42-04:00 — #4