How to convert sql query to oracle query?
Hi all,
Hope doing well,
sir i am using oracle database where i am running my sql query in oracle. but this query is not working properly. i used sql developer translation scratch editor to convert that.
it's converted but i am not getting the exact value.
which i was getting in sql server.
here is my query below:
SELECT C.*,ISNULL(P.Comp_Name,'') + ' (' + ISNULL(P.Comp_ID,'') + ')' Parent FROM Comp_Master C LEFT JOIN Comp_Master P ON C.Parent_ID = P.Comp_ID Where C.Comp_ID='C02'
please convert it into oracle so that i can use this query
thanks in advance.
Try --
1. Use NVL instead of isNull
2. Use *||* instead of +*
/* Formatted on 9-13-2012 4:39:09 PM (QP5 v5.163.1008.3004) */
SELECT c.*, NVL (p.comp_name, '') || ' (' || NVL (p.comp_id, '') || ')' parent
FROM comp_master c LEFT JOIN comp_master p ON c.parent_id = p.comp_id
WHERE c.comp_id = 'C02'
PS - Do remember to mark the solutions as Helpful or Correct. Thanks for understanding.
Similar Messages
-
How to convert SQL to PL/ORACLE
Hi All,
I have the MSSQL SQL statement as below:
select column_name
from information_schema.key_column_usage
where constraint_name in ( select constraint_name
from information_schema.table_constraints
where table_name = 'cppuUTMSTATS' and constraint_type = 'PRIMARY KEY' )
order by ordinal_position;
I would like to have the equivalent PL statement for ORACLE.
Please help.
Thanks,
JPThe only possible problem I see is that you're trying
to order with a non selected column, you need that
the order by column is in the select to make it
work.Really?
SQL> select ename, job
2 from emp
3 order by empno
4 ;
ENAME JOB
SMITH CLERK
ALLEN SALESMAN
WARD SALESMAN
JONES MANAGER
MARTIN SALESMAN
BLAKE MANAGER
CLARK MANAGER
SCOTT ANALYST
KING PRESIDENT
TURNER SALESMAN
ADAMS CLERK
JAMES CLERK
FORD ANALYST
MILLER CLERK
14 rows selected.
SQL>I don't have a problem with ordering by columns that aren't selected. -
How to convert SQL Server hierarchical query (CTE) to Oracle?
How to convert SQL Server hierarchical query (CTE) to Oracle?
WITH cte (col1, col2) AS
SELECT col1, col2
FROM dbo.[tb1]
WHERE col1 = 12
UNION ALL
SELECT c.col1, c.col2
FROM dbo.[tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
DELETE a
FROM dbo.[tb1] AS a INNER JOIN cte AS b
ON a.col1 = b.col1See: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2129904
Ah, just spotted it's a delete statement - you won't be able to do it using subquery factoring in Oracle.
I had a go at trying to convert for you, but notice that you reference the cte from inside the cte... I can only assume you have a table called cte too...
DELETE FROM dbo.tb1
WHERE col1 = 12
OR col2 IN (SELECT col1 FROM cte)
Edited by: Boneist on 22-Jun-2009 09:19 -
Converting MS SQL Server Query to Oracle Query
Hi There,
I've a strange problem. My project uses both MS SQL Server and Oracle server at run time. I've lot of queries which are written in MS SQL Style. Now, iam planning to write a helper class whic converts MS SQL Query to Oracle Query. Please Help me if any one has that kind of Helper with you.
Thanks And Regards,
Sasi KanthThat is why persistence applications like Hibernate or
CMP get used for apps that will use more than one DB,
but it takes upfront planning.
If you have a set of automated unit tests that work
with SQL Server, they will be a big help in getting
your Oracle code up and running.Indeed - JUnit and Ant would be a big help here.
It sounds like you have SQL in your JSPs, that will
work against you as well if so. If you are using a
DAO pattern, this will be much easier, as you can
re-implement each DAO for Oracle.If you'd layered this app properly, you might just implement an OracleDAOFactory and be done with it. Interfaces and a DAO layer would go a long way.
This is why layering is such a good idea. It isolates changes in a smaller subset of classes.
But your problem sounds pretty big. It'd be daunting even if it were well designed. -
How execute pl/sql command from Oracle ADF Business Components
can't find examples for how execute pl/sql command from Oracle ADF Business Components and how call pl/sql package procedure from ADF Business Components.
insert,update,delete rows in view object instance cache is good but if i must do some complex operations while insert,update,delete rows..it's more better for me to call
pl/sql procedure from oracle db.Am i wrong ????Roman,
this should be similar to how it worked in JDeveloper 9.0.3. hava a look at <JDev903 Home>\BC4J\samples\StoredProc for a code example.
Frank -
How to convert a dedicated running oracle server to a shared server
i need help as to how to convert a dedicated running oracle server to a shared server.(step by step plz i am fairly a fresh person)
there are presently 10 users but have to configure for 125 users accessing from 5 locations.
also need how to implement connection manager125 users are not so much, unless your database server is a quite small one. Anyway, you have to configure Dispatchers and Shared Servers. See Configuring Oracle Database for Shared Server
About Connection Manager see Configuring and Administering Oracle Connection Manager -
How to migrate sql 7 to oracle 9i ???
Hi,
Plz let me know the step by step solution of how to migrate sql 7 to oracle 9i? I am using oracle 9i and i have a d'base created in sql 7 and I am using win2000 server all are on the same server.if you could provide me the links which solve my problem.
thanks a lot
wityh regards : Alok KumarHi Alok,
Oracle have a tool called the Oracle Migration Workbench (OMWB). It is a free tool which can help you migrate you database from SQL Server 7 to Oracle 9i. You can find out more about it here.
http://www.oracle.com/technology/tech/migration/workbench/index.html
You basically need to download the OMWB Core part and then 1 of the plugins (You need to download the SQL Server 7 plugin).
Once these are installed you can connect to your SQL Server 7 database, capture the schema objects within, map these to their Oracle equivalents and then Generate then into you Oracle database. Its GUI wizard driven tool so its easy enough to use.
Note that this tool helps people move there databases to Oracle and is not a silver bullet. The more complex your database more time you need to rectify problems and test.
I hope this helps,
Dermot. -
How to convert LongRaw to String when querying using DB Adapter?
Hi All,
How do we use a DB Adapter to query on LONG Raw data? Is there a way to implicitly convert data to a string before returning the resultSet?
JDev: 11.1.1.4
Regards.Hi,
LONG RAW data will be retrieved as base64binary, you can use and Embed Java to convert it back to string.
How to convert String to base64Binary in BPEL process
Or you can use doTranslateFromNative oracle extension function, you will need a NXSD template to use it.
http://docs.oracle.com/cd/E15523_01/integration.1111/e10224/bp_appx_functs.htm#CJACABGA
Cheers,
Vlad -
How to convert SQL server stored procedures to Oracle 11g
Hi Experts,
In SQL server 30 stored procedures are there how to convert all the stored procedure
from SQL server to Oracle 11g.
Please help me,
Thanks.ramya_162 wrote:
In SQL server 30 stored procedures are there how to convert all the stored procedure
from SQL server to Oracle 11g.
The single most fundamental concept you need to understand (grok in its fullness) is:
ORACLE IS NOT SQL-SERVER
There is very little, to NOTHING, in common between T-SQL (a language extension to SQL) and PL/SQL (integration of SQL with the language Ada, part of ALGOL family of languages that includes Pascal and C++).
So taking a T-SQL procedure and porting it as is to PL/SQL is plain stupid.
Why?
Oracle sucks at trying to be SQL-Server.
So how do you migrate from SQL-Server to Oracle?
By taking the REQUIREMENTS that the T-SQL procedures address, and addressing these requirements using Oracle SQL and PL/SQL. -
How to convert SQVI to a normal query in SQ01 under client-specific query
Dear all,
I would like to know how to perform the following. Can you show me step by step as I don't know how to use SQ01 nor SQVI.
Convert SQVI to a normal query in SQ01 under client-specific query area
Thanks
tuffy
Thien is right. Invest some time into researching the above mentioned topics before turning to the forums for help.
Edited by: kishan P on Aug 25, 2010 10:24 AMHi,
If you don;t know any of them. I think you should take a little time to research or search from Google, SDN wiki,...
regards, -
How to pass runtime parameters to Oracle Query from xMII server
Please can anybody help me that how to pass runtime parameter to Orcle Query from xMII server.
It works the same way as I described in this thread [How to pass runtime parameters to MySQL Query from xMII server]. It does not matter the datasource MII will work the same for all queries, at least for passing in parameters. How to write those queries and their datatypes will be the differences.
-
How to get .ocp file when converting sql database to oracle database?
Hi all,
Hope doing well,
sir i am using sql developer tool for migration from sql server to oracle
i am using this offline but i don't know how to create .ocp file
please help me.
it's urgent
waiting for reply.
thanks in advance.The OCP files are created during OFFLINE Migration. In SQl Developer click on Tools -> Migration -> Create Database Capture Scripts. Choose an output directory, make sure to select the correct platform (Windows) and select MS SQl Server from the drop down list.
You'll get in the directory specified earlier the batch and OCP files required to create the source model using the offline method.
Have a look at this web site: http://www.oracle.com/technetwork/products/migration/sqlserver-095136.html
It contains more info including a link to a video demonstrating the offline capture method. -
Access Query to Oracle Query conversion
I am converting an Access database to Oracle 8.1.6.
There are lot of reports in Access. HOw can I convert the Access
query to Oracle equivalent query??? Is there any tool available
for conversion???FYI,
Microsoft Access is using ANSI SQL. And Oracle has introduced ANSI SQL from Oracle 9i so, it is also in 10g.
Oracle 10g does not stop backward compatibilty so, It is depends on person. And I am not forcing you to migrate query from ACCESS to Oracle. I have simply answer the question which you have asked. Whether you want to perform efficiently or not it's your choice.
But one thing is sure, ORACLE (9i or 10g) provides ANSI SQL and MS ACCESS is using ANSI sql so, this task is feasible. No doubt about it. -
How to convert mongodb data to oracle
The requirement is I need to convert the mongodb or JSON data which is provided to us in Oracle format
so that it can be used in Oracle Data Integrator ODI
Edited by: 918554 on Aug 9, 2012 10:37 PM
Edited by: 918554 on Aug 9, 2012 11:02 PM
Kindly reply soon its urgent
Edited by: 918554 on Aug 9, 2012 11:03 PM918554 wrote:
how to convert mongodb data to oracleThis is NOT an Oracle problem or solution.
http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart -
Help needed in changing Access query to Oracle query
hello folks,
I have already posted this question and got some help previously but i have additional query being added to the previous one so thought of seeking some help.here it goes
Am having an access report which comes from a query. the current query behind the report is a consolidated one and comes from quite a few tables . My requirement is to develop a crystal report( which comes with a native oracle db driver) which should look same as the access report. But am unable to use the access query becoz of its format or something. So anyone please throw some light on this. Any help would be kindly appreciated.
SELECT Debtor . EVENT_ID,
Debtor . MEDCAP#,
Debtor . Client Name,
Debtor . CLIENT,
Debtor . Provider ID,
Debtor . GROUPNUMBER,
"OPEN" AS Status,
(IIf(clip_file = "Y", "Clip", "Open")) AS clipStatus,
IIf(collect_only = "Y", "Collection Only", "Regular Collections") AS Collect ?,
IIf(IsNull(Principal), 0, principal,
IIf(IsNull(PAR_FLAG), "N", IIf(PAR_FLAG <> "N", "P", PAR_FLAG)) AS PAR_NPAR_FLAG,
Right(PatientMemberID, 2) AS Patient Suffix
FROM Period, Debtor
INNER JOIN LOB_subtypes ON Debtor . SUBTYPE = LOB_subtypes . SUBTYPE
WHERE (((Debtor . CLIENT) = "CV1") And ((Period . PeriodName) Is Not Null) And
((Debtor . STATUS) = "OPEN") And ((LOB_subtypes . LOB) = "PBA"));
ThanksThe expression...
IIf(IsNull(Principal), 0, principal) - IIf(IsNull(PRORATED_TRANAMT), 0, prorated_tranamt)...is equivalent to...
NVL(PRINCIPAL, 0) - NVL(PRORATED_TRANAMT, 0)Does that answer your question?
As for...
IIf(IsNull(PAR_FLAG), "N", IIf(PAR_FLAG<>"N", "P", PAR_FLAG))...you might try...
CASE
WHEN PAR_FLAG IS NULL THEN 'N'
WHEN PAR_FLAG != 'N' THEN 'P'
ELSE 'N'
END
Maybe you are looking for
-
Reduced battery life for high-end MBP 15 2011?
I just bought a new MBP 15" 2011 model (2.2 GHz), an upgrade from my previous MBP 2009 (MacBookPro5,3; Intel Core 2 Duo, 2.66GHz)). I have noticed that the real world battery life is significantly worse than the previous model (3-4 hours vs. 6-7 hour
-
Very bad bluetooth connection with car
I also have major back ground noise when connecting new 2730 classic (Software 10.40) to blue tooth in car (Mercedes C204) I tryed it with with some other Mercedes (E-Class an B-Class) and my old Medion Navigation system - same problem- can't underst
-
Classification of Purchase Info Records
Hi , Not sure if anyone can help me here - I've searched hi and low, but here goes.... Is it possible to add classification to a Purchase Info Record? Essentially info records will be created by a custom procedure and have a series of "normal" fields
-
I need a few things answered or some help please. I am trying to get openbox set-up nicely but have a few problems 1. Can you still have auto-mount feature like in gnome when I put in a cd or a thumbdrive and it mounts and has a icon in my thunar or
-
IWeb Captioning from Aperture Metadata
I posted this under the Aperture discussion section as well. A link to that post is below. I'm not sure if this should be under iWeb or Aperture. I use Aperture 2.1 and iWeb '08 2.0.3. In iWeb I have albums of photos from Aperture. When using the med