From Mysql to Oracle

From: sguazt <sguazt_at_tiscali.it>
Date: 8 Jul 2002 12:54:31 -0700
Message-ID: <509dfc26.0207081154.61ed6a6a_at_posting.google.com>


Hi,
I am a very beginner on ORACLE so excuse me if some question is very trivial.
I have a lot of code written for MySQL; now I have to pass to ORACLE 8i, but, as
you can imagine ;), I have some problem; for example I have query like:
SELECT COUNT(*),COUNT(IF(field1 = val1 OR field2 = val2, foo, NULL)),COUNT(IF(field3 = val3, bar, NULL)) FROM ... where with COUNT(IF(...)) I intend to count only that fields that satisfies
certain conditions; furthermore this type of query is very efficient since it
collects different counting (on possible different condition) with ONLY ONE
query, saving network traffic.
So IF(cond,true_val,false_val) equals to the well now C operator "cond ? true_val : false_val"; well in Oracle I didn't find a similar function.
Other problems with a MySQL LIMIT like operator; SELECT * FROM baz ... ORDER BY some_field LIMIT offset,size let us to consider only records starting from a position (offset), limiting the query result to size records. So this is VERY useful to show a long list of
item divided for pages:
for page 1, I will use LIMIT 0,size

for page 2, I will use LIMIT size,size
...
for page N, I will use LIMIT (N-1)*size, size Other problems may arise with the use of other MySQL function (like REGEXP used
to perform a fulltext search using regular expression, ....). So anyone has an idea to solve this problem?? Furthermore if someone knows a good site on this topic ... please send me it!
Thank you in advance!!!!

                                     Marco Guazzone
Received on Mon Jul 08 2002 - 21:54:31 CEST

Original text of this message