Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> if then else statement on 2 columns in SQL query?
Hi, I need to do a very simple if then statement on 2 columns and I was
wondering if it could be done in an SQL query without PL/SQL. ie some
variation of decode?
say I have 2 columns X and Y I want to do something like
if X.column ='Apples' then
decode(Y.column,'oranges','apples',Y.column)
if not then can I embed a PL/SQL function straight into the query? how would the syntax work( with the declares and semi-colons )? Or do I have to create a function first and then call this function in the SQL query?
Thanks in advance
Joe Grgas
joeyd_at_hunterlink.net.au
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Sun Oct 18 1998 - 20:34:19 CDT