oracle

Sql joining a table

I have a question regarding the SQL joins - Whenever we join two different tables on some fields, what will happen exactly inside oracle which will result in the query output? Does Oracle create/use a temporary table just for presenting the query output? ...

Can I use imp/exp tools to migrate database from Oracle 9 to Oracle 10

I'm subcontractor and my client wants to upgrade Oracle database from 9 to 10. Other vendor is going to perform the upgrade process, and I was asked to create whatever backup I need before the upgrade, and then recreate the environment in Oracle 10. All my data is stored in a separate database in a single schema. No fancy relations, scri...

SQL How to convert a decimal to a string

In a SELECT statement I want to convert values to strings ie. SELECT TO_STRING(value). How can I do this in Oracle SQL? ...

Using CASE Statements in LEFT OUTER JOIN in SQL

I've got a scenario where I want to switch on two different tables in an outer join. It goes something like this:- select mytable.id, yourtable.id from mytable left outer join (case when mytable.id = 2 then table2 yourtable on table1.id = table2.id ...

OracleDataSource connection caching - restarting connections?

Hello, Is it possible to set the Oracle connection cache to restart cached connections after a period of time? ...

predefined function or method available to get second highest salary from an employee table?

is there any predefined function or method available to get second highest salary from an employee table ...

Use analytic functions to group a set of records when timestamps in rows is less or equal than a value

Hi all, I have a table in an Oracle Database that has, among others, a DATE column that is loaded with the insertion timestamp of each row. I need to use existing data in such table to analyze the correlation between some events, so that with data like this: COL_1 COL_2 TS A 1 Mon 15, February 20...

Problem getting correct parameters for C# P/Invoke call to C++ dll

Trying to Interop a functionality from the Outside In API from Oracle. Have the following function: SCCERR EXOpenExport {VTHDOC hDoc, VTDWORD dwOutputId, VTDWORD dwSpecType, VTLPVOID pSpec, VTDWORD dwFlags, VTSYSPARAM dwReserved, VTLPVOID pCallbackFunc, VTSYSPARAM dwCallbackData, VTLPHEXPORT phExport); From the header files I redu...

(Oracle Performance) Will a query based on a view limit the view using the where clause?

In Oracle (10g), when I use a View (not Materialized View), does Oracle take into account the where clause when it executes the view? Let's say I have: MY_VIEW = SELECT * FROM PERSON P, ORDERS O WHERE P.P_ID = O.P_ID And I then execute the following: SELECT * FROM MY_VIEW WHERE MY_VIEW.P_ID = '1234' When this executes, does ora...

OID: How to add users to group through LDIF

How am I suppose to assign users a group? It seems that under this: dn: cn=<role_name>,cn=groups,<realm> objectclass: top objectclass: groupOfUniqueNames objectclass: orclGroup displayname: Role description: Role for this user uniquemember: <full DN> cn: <role_name> According to this example, when I add a group, I can specifiy...

Delete from empty table taking forver

Hello, I have an empty table that previously had a large amount of rows. The table has about 10 columns and indexes on many of them, as well as indexes on multiple columns. DELETE FROM item WHERE 1=1 This takes approximately 40 seconds to complete SELECT * FROM item this takes 4 seconds. The execution plan of SELECT * FROM ITEM ...

Oracle : Identifying duplicates in a table without index

When I try to create a unique index on a large table, I get a unique contraint error. The unique index in this case is a composite key of 4 columns. Is there an efficient way to identify the duplicates other than : select col1, col2, col3, col4, count(*) from Table1 group by col1, col2, col3, col4 having count(*) > 1 The explain pla...

comparing two cursors in oracle instead of using MINUS

The following query takes more than 3 minutes to run because tables contain massive amounts of data: SELECT RTRIM(LTRIM(A.HEAD)), A.EFFECTIVE_DATE, FROM TABLE_1 A WHERE A.TYPE_OF_ACTION='6' AND A.EFFECTIVE_DATE >= ADD_MONTHS(SYSDATE,-15) MINUS SELECT RTRIM(LTRIM(B.head)), B.EFFECTIVE_DATE, ...

code duplication in sql case statements

Hi I'm trying to output something like the following but am finding that there is a lot of code duplication going on. | australian_has_itch | kiwi_has_itch | | yes | no | | no | n/a | | n/a | no | ... My query looks like this with two case statements tha...

Oracle SELECT TOP 10 records

Hi, i have an big problem with an SQL Statement in Oracle. I want to select The TOP 10 Records ordered by STORAGE_DB wich arent in a list from an other select statement. This one works fine for all records: SELECT DISTINCT APP_ID, NAME, STORAGE_GB, HISTORY_CREATED, TO_CHAR(HISTORY_DATE, 'DD.MM.YYYY') AS HISTORY_DATE ...

Oracle: set timezone for column

Hi, I need to do migration date->timestamp with timezone similar to described here: http://stackoverflow.com/questions/1664627/migrating-oracle-date-columns-to-timestamp-with-timezone. But I need to make additional convertion (needed to work correctly with legacy apps): for all dates we need to change timezone to UTC and set time to 12:...

Multiple resultsets from Oracle in Odp.net,without refcursors

SQL Server is able to return the results of multiple queries in a single round-trip, e.g: select a, b, c from y; select d, e, f from z; Oracle doesn't like this syntax. It is possible to use reference cursors, like this: begin open :1 for select count(*) from a; open :2 for select count(*) from b; end; However, you incur a ...

How to export Oracle statistics

Hi, I am writing some new SQL queries and want to check the query plans that the Oracle query optimiser would come up with in production. My development database doesn't have anything like the data volumes of the production database. How can I export database statistics from a production database and re-import them into a development...

Retrieve autogenerated key in Oracle with SubSonic 2.2

Hi guys, I'm currently using SubSonic 2.2 to code against an Oracle XE DB, which carries certain tables that have a primary key which gets automatically filled by means of a sequence and corresponding trigger. In SQL Server this isn't a problem, since SubSonic automatically fills in the autoincrement key value into the correct property...

Objective-C: Database support

How can I connect to an Oracle database and SQL Server 2005-2008 database with Objective-C? ...