SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Error:Right Parenthesis is required in Oracle Toad.


Error:Right Parenthesis is required in Oracle Toad.

Author
Message
swainsarada
swainsarada
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 3
string str3 = "SELECT a.siebleloginid, a.employee, MAX (a.tierlevel) AS tier FROM"+
"((SELECT e.siebleloginid, e.lastname || ', ' || e.firstname AS employee,"+
"DECODE (e.siebleloginid, m.siebleloginid, 2, DECODE (e.username, z.usernamesup, 1, 0) )"+
"AS tierlevel FROM emadministration.tblemployeeinfo m, emadministration.tblemployeeinfo e,"+
"emadministration.tblzlistsectsup z WHERE m.siebleloginid ='OLEMSUP' AND"+
"z.usernameman = m.username AND e.section = z.section AND e.employmentstatus = 'Active')"+
"UNION (SELECT e.siebleloginid, e.lastname || ', ' || e.firstname AS employee, "+
"DECODE (e.siebleloginid, m.siebleloginid, 1, 0 ) AS tierlevel FROM "+
"emadministration.tblemployeeinfo m, emadministration.tblemployeeinfo e,"+
"emadministration.tblzlistsectsup z WHERE m.siebleloginid ='OLEMSUP'"+
"AND (z.usernamesup = m.username OR (z.usernametempsup = m.username "+
"AND z.tempsupenddate >= TRUNC (SYSDATE - 0.25)))"+
"AND e.section = z.section AND e.employmentstatus = 'Active') "+
"UNION (SELECT e.siebleloginid, e.lastname || ', ' || e.firstname AS employee,"+
"DECODE (zm.usernameman, NULL, DECODE (zs.usernamesup, NULL, 0, 1),2) AS tierlevel"+
"FROM emadministration.tblemployeeinfo e, emadministration.tblzlistsectsup zm,"+
"emadministration.tblzlistsectsup zs WHERE e.siebleloginid ='OLEMSUP' AND"+
"e.employmentstatus = 'Active'AND e.username = zm.usernameman(+) AND"+
"e.username = zs.usernamesup(+))) a GROUP BY a.siebleloginid, a.employee"+
"ORDER BY tier DESC, employee";
Jo Pattyn
Jo Pattyn
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2842 Visits: 9903
Could you use code tags?
AND"+
"z.usernameman
concatenates to andz.usernameman which is invalid
Trying to generate dynamic sql?
Lowell
Lowell
One Orange Chip
One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)

Group: General Forum Members
Points: 29060 Visits: 39984
I don't use TOAD, but i do some Oracle conversions a lot.

i thought ALL concatenation in Oracle must use double pipes...why do i see you trying to + strings togehter? is that a toad functionality?
should it be more like this?

string str3 = " SELECT a.siebleloginid, a.employee, MAX (a.tierlevel) AS tier FROM "
|| " ((SELECT e.siebleloginid, e.lastname || ', ' || e.firstname AS employee, "
|| " DECODE (e.siebleloginid, m.siebleloginid, 2, DECODE (e.username, z.usernamesup, 1, 0) ) "
|| " AS tierlevel FROM emadministration.tblemployeeinfo m, emadministration.tblemployeeinfo e, "
|| " emadministration.tblzlistsectsup z WHERE m.siebleloginid ='OLEMSUP' AND "
|| " z.usernameman = m.username AND e.section = z.section AND e.employmentstatus = 'Active') "
|| " UNION (SELECT e.siebleloginid, e.lastname || ', ' || e.firstname AS employee, "
|| " DECODE (e.siebleloginid, m.siebleloginid, 1, 0 ) AS tierlevel FROM "
|| " emadministration.tblemployeeinfo m, emadministration.tblemployeeinfo e, "
|| " emadministration.tblzlistsectsup z WHERE m.siebleloginid ='OLEMSUP' "
|| " AND (z.usernamesup = m.username OR (z.usernametempsup = m.username "
|| " AND z.tempsupenddate >= TRUNC (SYSDATE - 0.25))) "
|| " AND e.section = z.section AND e.employmentstatus = 'Active') "
|| " UNION (SELECT e.siebleloginid, e.lastname || ', ' || e.firstname AS employee, "
|| " DECODE (zm.usernameman, NULL, DECODE (zs.usernamesup, NULL, 0, 1),2) AS tierlevel "
|| " FROM emadministration.tblemployeeinfo e, emadministration.tblzlistsectsup zm, "
|| " emadministration.tblzlistsectsup zs WHERE e.siebleloginid ='OLEMSUP' AND "
|| " e.employmentstatus = 'Active'AND e.username = zm.usernameman(+) AND "
|| " e.username = zs.usernamesup(+))) a GROUP BY a.siebleloginid, a.employee "
|| " ORDER BY tier DESC, employee " ;



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
SSCertifiable
SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)

Group: General Forum Members
Points: 5563 Visits: 4639
Lowell (11/29/2011)
i thought ALL concatenation in Oracle must use double pipes


You are correct Lowell.

_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search