Convertion ORACLE query to MYSQL

2006-11-09 Thread ViSolve DB Team
Hi Experts,

We are in the process of converting Oracle administration commands into MySQL 
for some purposes. We dont know how to convert the following Oracle commands to 
MySQL. How to do that..?

1. ALTER USER spec TEMPORARY TABLESPACE temp_ts;

2. DROP USER jbossjms1 CASCADE;

3. DROP TABLESPACE jbossjms1 INCLUDING CONTENTS;

4. CREATE TABLESPACE jbossjms1DATAFILE '${JBOSSJMS1}' SIZE 100M REUSE 
AUTOEXTEND ON MAXSIZE UNLIMITED;

5. CREATE USER jbossjms1 IDENTIFIED BY jbossjms1DEFAULT TABLESPACE jbossjms1;

Thanks in Advance,

ViSolve PlanCAT Team


Re: Convertion ORACLE query to MYSQL

2006-11-09 Thread Anders Karlsson
These commands are Oracle specific or contains Oracle specific 
extensions. Nothing wrong with that, but in some cases there just is no 
corresponding command in MySQL, as the concepts are different.


ViSolve DB Team wrote:

Hi Experts,

We are in the process of converting Oracle administration commands into MySQL 
for some purposes. We dont know how to convert the following Oracle commands to 
MySQL. How to do that..?

1. ALTER USER spec TEMPORARY TABLESPACE temp_ts;
  
In MySQL there are no tablespaces in general, although certain storage 
engines use them. But they have completely different properties from 
what is the case with Oracle. Also, there is no such thing as a specific 
temporary tablespace.

2. DROP USER jbossjms1 CASCADE;
  
DROP USER works fine in MySQL. In Oracle, there is a specific connection 
between a User and the Schema, or rather, they are the same. In MySQL, 
these are different, there is a schema (or in MySQL, a database) and 
then there is granted access to that schema, that is it, there is no 
specific ownership of a schema. Assuming you set up MySQL the same way 
as Oracle, that each user (jbossjms1) gets his own schema (jbossjms1) 
and you want to drop both of those, in MySQL you would:

DROP DATABASE jbossjms1;
DROP USER jbossjms1;

3. DROP TABLESPACE jbossjms1 INCLUDING CONTENTS;
  
As there is a DROP TABLESPACE command in MySQL 5.1, but that does not 
with all certainty do what you want it to. The closest command is 
probably DROP DATABASE, but that assumes that you have all the jbossjms1 
objects in that database. I'd be careful here though, and read up on 
these commands in both Oracle and MySQL before you do this, as this 
might, and again might not, do what you want. These are admin commands, 
which typically work differently in different RDBMS systems.

4. CREATE TABLESPACE jbossjms1DATAFILE '${JBOSSJMS1}' SIZE 100M REUSE 
AUTOEXTEND ON MAXSIZE UNLIMITED;
  
This is again an administration commend. Assuming you are using the 
InnoDB storage engine, this command corresponds to 
innodb_data_file_path setting in the MySQL configuration file (my.cnf 
/ my.ini etc).

5. CREATE USER jbossjms1 IDENTIFIED BY jbossjms1DEFAULT TABLESPACE jbossjms1;
  
This command works similarly same in MySQL, with the exception that 
there is no concept of a DEFAULT TABLESPACE in MySQL.

Thanks in Advance,

ViSolve PlanCAT Team

  


--
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /  Anders Karlsson ([EMAIL PROTECTED])
 / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Sales Engineer
/_/  /_/\_, /___/\___\_\___/ Stockholm
   ___/   www.mysql.com Cellphone: +46 708 608121



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Convertion ORACLE query to MYSQL

2006-11-09 Thread Grant Allen

On 11/9/06, ViSolve DB Team [EMAIL PROTECTED] wrote:

Hi Experts,

We are in the process of converting Oracle administration commands into MySQL 
for some purposes. We dont know how to convert the following Oracle commands to 
MySQL. How to do that..?

1. ALTER USER spec TEMPORARY TABLESPACE temp_ts;


There's no equivalent concept in MySQL to a temp tablespace.  The key
with them in Oracle is actions performed in a temp tablespace aren't
logged (sorts and hashes that overflow the memory), and the files that
constitute them aren't required for recovery.


2. DROP USER jbossjms1 CASCADE;


No equivalent to the cascade option ... so create a script-generating
script, or drop the database if you've equated schema with database.


3. DROP TABLESPACE jbossjms1 INCLUDING CONTENTS;


You normally don't need to muck around with a storage engine's
low-level tablespace management.  You might want to work out what
objects this would drop, and do that instead.


4. CREATE TABLESPACE jbossjms1DATAFILE '${JBOSSJMS1}' SIZE 100M REUSE 
AUTOEXTEND ON MAXSIZE UNLIMITED;


Ensure the files in your innodb_data_file_path have the autoextend
property set, and total atleast 100MB in size.  The Oracle syntax
above uses ASM-based storage, which has no equivalent in MySQL, so
forget that bit


5. CREATE USER jbossjms1 IDENTIFIED BY jbossjms1DEFAULT TABLESPACE jbossjms1;


As per normal user creation ... just ignore the tablespace bit.

Ciao
Fuzzy
:-)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Oracle query to mysql

2004-09-28 Thread martin fasani

Hi guys,

I'm working in a telecom company that has Oracle for the call statistics.
Now we export the daily stats to a remote mySql.

The daily resume table looks like this:
++---+-++--+
--+++
| IMRFLL | IMR906| IMRTER  | IMRTAR | IMRDUR   |
IMRFAC   | IMRCLI | IMRCLL | 
++---+-++--+
--+++
| 2004-06-01 | 803xx |   x | N  |  446.9166572 |
40355904 | 21 | 26 | 
| 2004-06-01 | 803xx |   0 | R  |9.414 |
40355904 | 21 | 10 | 
++---+-++--+
--+++

What I need it's to get a report that joins the table to itself two times to
get the Normal tarif ( IMRTAR=N) and the Reduced tarif (IMRTAR=R).

In Oracle is done using Outer joins like this:
SELECT IMRTAB.IMR906 AS NUM906,IMRTAB.IMRFLL AS FLL, SUM(IMRTAB.IMRCLL) AS
CLL ,ROUND(SUM(IMRTAB.IMRDSC),2) AS DUR,
ROUND(SUM(IMRTAB.IMRDSC)/SUM(IMRTAB.IMRCLL),2) AS PRO, SUM(IMRTAB1.IMRCLL)
AS CLL_N,ROUND(SUM(IMRTAB1.IMRDSC),2) AS
DUR_N,ROUND(SUM(IMRTAB1.IMRDSC)/SUM(IMRTAB1.IMRCLL),2) AS PRO_N,
SUM(IMRTAB2.IMRCLL) AS CLL_R,ROUND(SUM(IMRTAB2.IMRDSC),2) AS
DUR_R,ROUND(SUM(IMRTAB2.IMRDSC)/SUM(IMRTAB2.IMRCLL),2) AS PRO_R
FROM IMRTAB, IMRTAB IMRTAB1, IMRTAB IMRTAB2  /* here does the tables alias
*/

WHERE IMRTAB.IMRIDE = IMRTAB1.IMRIDE (+) AND IMRTAB.IMRIDE = IMRTAB2.IMRIDE
(+) /* links by the uniqID both alias */
AND (IMRTAB1.IMRTAR (+) = 'N') /* takes N calls and discard the rest for
IMRTAB1 */
AND (IMRTAB2.IMRTAR (+) = 'R') /* takes R calls and discard the rest for
IMRTAB2 */

AND (IMRTAB.IMRFLL BETWEEN '01/09/2004' and '10/09/2004') AND (IMRTAB.IMRCLI
=2584 AND (IMRTAB.IMR906=803xx )) GROUP BY IMRTAB.IMR906,IMRTAB.IMRFLL
ORDER BY IMRTAB.IMR906,IMRTAB.IMRFLL

And this query returns something like this:
+---++++++
| NUM906| FLL| CLL| DUR| DUR_N  | CLL_N  | DUR_R  |
CLL_R 
+---++++++
| 803xx | 2004-09-02 |  1 |   4.30 |   4.30 |  1 | 
| 803xx | 2004-09-01 |  2 |   0.00 |   0.00 |  2 |
+---++++++
I took out some fields in this graphic just to simplify.

I've been trying to get this query running for mysql but I can get the same
results and I kill the DB. Does someone knows if I can get the same result ?

Thanks is advance,
MARTIN
[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Oracle query to mysql

2004-09-28 Thread SGreen
Your original Oracle(R) query (slightly reformatted):

SELECT IMRTAB.IMR906 AS NUM906
, IMRTAB.IMRFLL AS FLL
, SUM(IMRTAB.IMRCLL) AS CLL 
, ROUND(SUM(IMRTAB.IMRDSC),2) AS DUR
, ROUND(SUM(IMRTAB.IMRDSC)/SUM(IMRTAB.IMRCLL),2) AS PRO
, SUM(IMRTAB1.IMRCLL) AS CLL_N
, ROUND(SUM(IMRTAB1.IMRDSC),2) AS DUR_N
, ROUND(SUM(IMRTAB1.IMRDSC)/SUM(IMRTAB1.IMRCLL),2) AS PRO_N
, SUM(IMRTAB2.IMRCLL) AS CLL_R
, ROUND(SUM(IMRTAB2.IMRDSC),2) AS DUR_R
, ROUND(SUM(IMRTAB2.IMRDSC)/SUM(IMRTAB2.IMRCLL),2) AS PRO_R
FROM IMRTAB
, IMRTAB IMRTAB1
, IMRTAB IMRTAB2  /* here does the tables alias*/
WHERE IMRTAB.IMRIDE = IMRTAB1.IMRIDE (+) 
AND IMRTAB.IMRIDE = IMRTAB2.IMRIDE (+) /* links by the uniqID both 
alias */
AND (IMRTAB1.IMRTAR (+) = 'N') /* takes N calls and discard the 
rest for IMRTAB1 */
AND (IMRTAB2.IMRTAR (+) = 'R') /* takes R calls and discard the 
rest for IMRTAB2 */
AND (IMRTAB.IMRFLL BETWEEN '01/09/2004' and '10/09/2004') 
AND (IMRTAB.IMRCLI=2584 AND (IMRTAB.IMR906=803xx )) 
GROUP BY IMRTAB.IMR906,IMRTAB.IMRFLL
ORDER BY IMRTAB.IMR906,IMRTAB.IMRFLL


My MySQL translation:

SELECT IMRTAB.IMR906 AS NUM906
, IMRTAB.IMRFLL AS FLL
, SUM(IMRTAB.IMRCLL) AS CLL 
, ROUND(SUM(IMRTAB.IMRDSC),2) AS DUR
, ROUND(SUM(IMRTAB.IMRDSC)/SUM(IMRTAB.IMRCLL),2) AS PRO
, SUM(IMRTAB1.IMRCLL) AS CLL_N
, ROUND(SUM(IMRTAB1.IMRDSC),2) AS DUR_N
, ROUND(SUM(IMRTAB1.IMRDSC)/SUM(IMRTAB1.IMRCLL),2) AS PRO_N
, SUM(IMRTAB2.IMRCLL) AS CLL_R
, ROUND(SUM(IMRTAB2.IMRDSC),2) AS DUR_R
, ROUND(SUM(IMRTAB2.IMRDSC)/SUM(IMRTAB2.IMRCLL),2) AS PRO_R
FROM IMRTAB
LEFT JOIN IMRTAB IMRTAB1
ON IMRTAB.IMRIDE = IMRTAB1.IMRIDE
AND IMRTAB1.IMRTAR = 'N' /* N calls only for IMRTAB1 */
LEFT JOIN IMRTAB IMRTAB2 
ON IMRTAB.IMRIDE = IMRTAB2.IMRIDE
AND IMRTAB2.IMRTAR = 'R' /* R calls only for IMRTAB2 */
WHERE IMRTAB.IMRFLL BETWEEN '2004-09-01' and '2004-09-10'
AND IMRTAB.IMRCLI=2584 
AND IMRTAB.IMR906=803xx
GROUP BY IMRTAB.IMR906,IMRTAB.IMRFLL
ORDER BY IMRTAB.IMR906,IMRTAB.IMRFLL


You were using the Oracle syntax , ...(+) to declare your outer joins. 
The equivalent MySQL form is LEFT JOIN... ON 

http://dev.mysql.com/doc/mysql/en/JOIN.html


I also had to reformat the dates in your WHERE clause to be MySQL 
formatted:
'01/09/2004' (dd/mm/) = '2004-09-01' (-mm-dd)

http://dev.mysql.com/doc/mysql/en/Date_and_time_types.html
http://dev.mysql.com/doc/mysql/en/DATETIME.html


Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
martin fasani [EMAIL PROTECTED] wrote on 09/28/2004 07:23:38 AM:

 
 Hi guys,
 
 I'm working in a telecom company that has Oracle for the call 
statistics.
 Now we export the daily stats to a remote mySql.
 
 The daily resume table looks like this:
 
++---+-++--+
 --+++
 | IMRFLL | IMR906| IMRTER  | IMRTAR | IMRDUR   |
 IMRFAC   | IMRCLI | IMRCLL | 
 
++---+-++--+
 --+++
 | 2004-06-01 | 803xx |   x | N  | 
446.9166572 |
 40355904 | 21 | 26 | 
 | 2004-06-01 | 803xx |   0 | R  | 9.414 
|
 40355904 | 21 | 10 | 
 
++---+-++--+
 --+++
 
 What I need it's to get a report that joins the table to itself two 
times to
 get the Normal tarif ( IMRTAR=N) and the Reduced tarif (IMRTAR=R).
 
 In Oracle is done using Outer joins like this:
 SELECT IMRTAB.IMR906 AS NUM906,IMRTAB.IMRFLL AS FLL, SUM(IMRTAB.IMRCLL) 
AS
 CLL ,ROUND(SUM(IMRTAB.IMRDSC),2) AS DUR,
 ROUND(SUM(IMRTAB.IMRDSC)/SUM(IMRTAB.IMRCLL),2) AS PRO, 
SUM(IMRTAB1.IMRCLL)
 AS CLL_N,ROUND(SUM(IMRTAB1.IMRDSC),2) AS
 DUR_N,ROUND(SUM(IMRTAB1.IMRDSC)/SUM(IMRTAB1.IMRCLL),2) AS PRO_N,
 SUM(IMRTAB2.IMRCLL) AS CLL_R,ROUND(SUM(IMRTAB2.IMRDSC),2) AS
 DUR_R,ROUND(SUM(IMRTAB2.IMRDSC)/SUM(IMRTAB2.IMRCLL),2) AS PRO_R
 FROM IMRTAB, IMRTAB IMRTAB1, IMRTAB IMRTAB2  /* here does the tables 
alias
 */
 
 WHERE IMRTAB.IMRIDE = IMRTAB1.IMRIDE (+) AND IMRTAB.IMRIDE = 
IMRTAB2.IMRIDE
 (+) /* links by the uniqID both alias */
 AND (IMRTAB1.IMRTAR (+) = 'N') /* takes N calls and discard the rest for
 IMRTAB1 */
 AND (IMRTAB2.IMRTAR (+) = 'R') /* takes R calls and discard the rest for
 IMRTAB2 */
 
 AND (IMRTAB.IMRFLL BETWEEN '01/09/2004' and '10/09/2004') AND 
(IMRTAB.IMRCLI
 =2584 AND (IMRTAB.IMR906=803xx )) GROUP BY 
IMRTAB.IMR906,IMRTAB.IMRFLL
 ORDER BY IMRTAB.IMR906,IMRTAB.IMRFLL
 
 And this query returns something like this:
 +---++++++
 | NUM906| FLL| CLL| DUR| DUR_N  | CLL_N  | DUR_R  |
 CLL_R