Home » Developer & Programmer » JDeveloper, Java & XML » converting mysql functions to oracle; using java language
converting mysql functions to oracle; using java language [message #111599] Thu, 17 March 2005 22:05 Go to next message
cjpangilinan
Messages: 5
Registered: March 2005
Junior Member

how can i convert mysql functions, like length(),now(),date(),etc. to oracle? i use java in web development. my current db is mysql and i want to migrate it to oracle. i have already done the db migration. the problemm is the codes in my java, some are not standard sql but specific to mysql and does not work in oracle.
pls i need help asap.
thanks..
cj

ps: im currently searching the archives for the answers but i also need your imediate reply..
Re: converting mysql functions to oracle; using java language [message #111612 is a reply to message #111599] Fri, 18 March 2005 02:28 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Length() is a built-in sql function in Oracle to.
Date()? If you're looking for the current date, you want SYSDATE, but if you're trying to cast VARCHAR2 or numeric data to a DATE, you'll need to_date().

MHE
Re: converting mysql functions to oracle; using java language [message #111619 is a reply to message #111612] Fri, 18 March 2005 03:38 Go to previous messageGo to next message
cjpangilinan
Messages: 5
Registered: March 2005
Junior Member

what else? is there any mysql functions that u know has equivalent oracle functions?

i want to thank you ...
thanks a lot for the help..
Re: converting mysql functions to oracle; using java language [message #111620 is a reply to message #111619] Fri, 18 March 2005 03:51 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
cjpangilinan wrote on Fri, 18 March 2005 10:38

what else?


Perhaps this page might help you out a little...

Why don't you list the ones you're not sure of?

MHE
Re: converting mysql functions to oracle; using java language [message #111621 is a reply to message #111620] Fri, 18 March 2005 03:55 Go to previous messageGo to next message
cjpangilinan
Messages: 5
Registered: March 2005
Junior Member

hey thanks.. why didn't i found this one.. i've been searching since this week. thanks a lot..
Re: converting mysql functions to oracle; using java language [message #111807 is a reply to message #111620] Sun, 20 March 2005 23:22 Go to previous messageGo to next message
cjpangilinan
Messages: 5
Registered: March 2005
Junior Member

question again, needing an immediate reply.. thanks a lot.. why is it that the rand() function doesn't run on Oracle? what is the equivalent of that in Oracle?
Re: converting mysql functions to oracle; using java language [message #111811 is a reply to message #111807] Mon, 21 March 2005 00:48 Go to previous messageGo to next message
cjpangilinan
Messages: 5
Registered: March 2005
Junior Member

one thing more, the match() and against() of mysql, what are their equivalent to Oracle? thanks

here is the code:
select a.blog_dtl_id AS blog_dtl_id, count( a.blog_dtl_id ) AS sum, c.user_name, d.* from BLOG_TRANSACTIONS a, BLOG_DTL b, BLOG_USER c, BLOG_SITE d WHERE b.blog_id = d.blog_id AND d.user_id = c.user_id AND LENGTH(b.blog_image) > 0 AND a.blog_dtl_id = b.blog_dtl_id AND b.blog_dtl_status < 3 AND a.trans_type IN ( 1, 8, 10, 12 ) GROUP BY a.blog_dtl_id ORDER BY sum DESC

select a.*, b.user_name from BLOG_SITE a, BLOG_USER b where MATCH(a.blog_name) AGAINST ('"+query+"') and a.blog_status < 3 and a.user_id = b.user_id order by a.blog_name asc

select a.blog_url, a.date_created, b.user_name, c.blog_dtl_id, c.blog_post_title from BLOG_SITE a, BLOG_USER b, BLOG_DTL c where MATCH(c.blog_post_title) AGAINST ('"+query+"') and a.blog_status < 3 and a.user_id = b.user_id AND a.blog_id = c.blog_id order by c.blog_post_title asc

SELECT blog_url FROM BLOG_SITE ORDER BY RAND() LIMIT 0,1

[Updated on: Mon, 21 March 2005 01:30]

Report message to a moderator

Re: converting mysql functions to oracle; using java language [message #111850 is a reply to message #111811] Mon, 21 March 2005 06:20 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
First, go to http://otn.oracle.com (Oracle Technology Network) and register yourself. It's free and you'll have access to the Oracle online documentation at http://tahiti.oracle.com. Bookmark the latter, it's worth it.

Now, rand() as such does not exist in Oracle as a built-in function. Oracle has provided the DBMS_RANDOM package instead.

It could help if you would post your Oracle version, but depending on your version, you could do text search via:
- the LIKE operator.
- Oracle Text and a TEXT index and the CONTAINS operator. This requires some work and is not frequently used.
- In 10g, you can do a regular expression search via the REGEXP_LIKE operator.


HTH,
MHE
Previous Topic: Creating a SQL-query Progress-Bar
Next Topic: JSP (or Java) and Oracle HELP!
Goto Forum:
  


Current Time: Fri Nov 22 10:03:26 CST 2024