oracle

How can I get a distinct list of elements in a hierarchical query?

I have a database table, with people identified by a name, a job and a city. I have a second table that contains a hierarchical representation of every job in the company in every city. Suppose I have 3 people in the people table: [name(PK),title,city] Jim, Salesman, Houston Jane, Associate Marketer, Chicago Bill, Cashier, New York ...

How to avoid OCIError in rails application?

OCIError (ORA-12541: TNS:no listener): oci8.c:270:in oci8lib.so /usr/local/ruby-1.8.7-p248/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:223:in `new' /usr/local/ruby-1.8.7-p248/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapte...

Oracle on Linux with ASP.NET Windows Authentication Impersonation

Can someone please direct me on how to do this type of setup, i.e. I have a Windows Server with ASP.NET pages and would like to pass those credentials using Integrated Windows Authentication to a Linux-based Oracle DB. ...

Performance: Subquery or Joining

Hello I got a little question about performance of a subquery / joining another table INSERT INTO Original.Person ( PID, Name, Surname, SID ) ( SELECT ma.PID_new , TBL.Name , ma.Surname, TBL.SID FROM Copy.Person TBL , original.MATabelle MA WHERE TBL.PID = p_PID_old AND TBL.PID = MA.PID_old ...

Oracle Query for getting CURRENT CTC (Salary) of Each Employee

i want current CTC of each employee following is the design of my table Ecode Implemented Date Salary 7654323 2010-05-20 350000 7654322 2010-05-17 250000 7654321 2003-04-01 350000 7654321 2004-04-01 450000 7654321 2005-04-01 ...

Oracle Extended Stored Procedure with C++

I am currently adding Oracle 10.2.0. as a viable database to a product. The product originally allows connection to SQL Server and I have found some extended stored procedures. Is it possible to produce similar extended stored procedures for Oracle with C++? If so, how do I accomplish this? Example code would be much appreciated. ...

Are conditional subqueries optimized out, if the condition is false?

I have a table foo and a table bar, where each foo might have a bar (and a bar might belong to multiple foos). Now I need to select all foos with a bar. My sql looks like this SELECT * FROM foo f WHERE [...] AND ($param IS NULL OR (SELECT ((COUNT(*))>0) FROM bar b WHER...

oracle primary_key and foreign_key

Is it possible to maintain relationship between two tables without primary key and foreign key if it is possible then how? ...

How to handle a single quote in Oracle SQL

How do I insert a record in a column having varchar data type having single quote in it? Example: first name is ROBERT and last name is D'COSTA ...

Is there an SQL Server equivalent to Oracle's RETURNING statement?

Is there an SQL Server equivalent to Oracle's RETURNING statement? I'm wondering if the OUTPUT clause would help. ...

help in setting Client Info in JDBC for Oracle

hello everybody i have an issue cause i have a java an application which needs to be audited so obviously i need a way in which the app can be identified with the application name so i googled and found that the ojdbc14 has the method .setClientInfo which allows to register the application with a customized name so i am trying to get it ...

Oracle SELECT query: collapsing null values when pairing up dates

I have the following Oracle query: SELECT id, DECODE(state, 'Open', state_in, NULL) AS open_in, DECODE(state, 'Not Open', state_in, NULL) AS open_out, FROM ( SELECT id, CASE WHEN state = 'Open' THEN 'Open' ELSE 'Not Open' END AS state, T...

Problem with UPDATE statement in stored-procedure in Oracle Database

Hello, I have stored-procedure in Oracle database like this: create or replace PROCEDURE EDYTUJ_PRACOWNIKA (PR_IMIE IN VARCHAR2, PR_NAZWISKO IN VARCHAR2, PR_PENSJA IN FLOAT, PR_PRZELOZONY IN NUMBER, PR_ODDZIAL IN NUMBER, PRAC_ID IN NUMBER) AS tmpPensja FLOAT := 0; tmpPrzel NUMBER := 0; BEGIN select przelozony into tmpPrzel from pr...

Is it possible to modify the value of a record's primary key in Oracle when child records exist?

I have some Oracle tables that represent a parent-child relationship. They look something like this: create table Parent ( parent_id varchar2(20) not null primary key ); create table Child ( child_id number not null primary key, parent_id varchar2(20) not null, constraint fk_parent_id foreign key (parent_id) ...

Anybody seen this behavior with Sql Server Reporting Services, a 64bit OS and an Oracle datasource?

I'm working on a Sql Server Reporting Services solution that queries across both a Sql Server data source and an Oracle 10g data source. My dev box is Windows 7 64bit with Sql Server 2008R2 and I'm hosting IIS7 and SSRS on that system for development; using VS.NET for designing the reports. I have been having errors when running the rep...

i want Oracle Query for Formatted Output

Following is my table deign Ecode Degree YOQ 7654321 SSC 2000 7654321 HSC 2002 7654321 Bcom 2006 7654321 MCA 2010 7654322 SSC 2002 7654322 HSC 2004 7654322 Bcom ...

number of rows affected by rollback

Hi, I need to find out the number of rows affected by a rollback. How can I get this ? Please help. ...

Free tool to watch database for changes?

Im looking for a tool that can watch database(mysql and oracle) for changes. When someone inserts or updates something in any(or chosen) table i want to get to know about it. It could be very useful for working with others people code that do some magic in database. I know that it can be done using triggers (see this question), but im ...

Returning a row from a With clause

Hello im trying to make a Function that retruns a value. in my function i have this script: WITH t_new AS ( SELECT PersIDOLD, PersIDNEW, RightsMUT, SUM(gap) over(ORDER BY PersIDOLD, PersIDNEW) grp FROM ( SELECT h1.*, CASE WHEN h1.PersIDNEW = lag(h1.PersIDNEW) ...

Maximum characters query “Query/Where windows pops up”

By default what is the maximum characters query length in “Query/Where windows pops up” in oracle form, and how can we increase them. ...