oracle

Oracle query is slow (or fails) from .NET app but is fast from SQL Developer

We use ODP.NET to perform queries on Oracle databases, and normally it works fine. There is a particular database, and a particular view in that database, though, that we just can't complete a query on from .NET. For example: SELECT some_varchar_field FROM the_view WHERE ROWNUM < 5; If I execute this query from within Oracle SQL devel...

conditional update on same column

Hi Pl find code below SQL> desc aaa Name Null? Type ----------------------------------------- -------- ---------------------------- ENAME VARCHAR2(1) SQL> select * from aaa; E - 2 2 2 5 5 5 5 7 rows selected. I need to update 2 with 5 and 5 w...

How does Oracle process stored function calls in SQL?

Hi, guys. Say, I have a query: select t.value, my_stored_function(t.value) from my_table t where my_stored_function(t.value) = n_Some_Required_Value I have rewritten it in the following way: select value, func_value from (select t.value, my_stored_function(t.value) func_value from my_table t) subquery where subquery....

SELECT IDENT_CURRENT(‘tablename’) in Oracle

Hello, I'm new with PL/SQL and I need last inserted id in data table after insert statement. Like on MS SQL SELECT IDENT_CURRENT(‘tablename’) Thanks in advance! Goran ...

How to implement a cross-database foreign key constraint?

Let's say I have two schemas: HR and Orders. [HR].Employees [Orders].Entries -------------- ---------------- Id_Employee ----> Employee Fullname Id_Entry Birthday Description Amount As you can see, what I'd want is to be able to establish a cross-database foreign ...

List network printers with oracle sql

Is there way to list all printers on a domain? note:I can use delphi 4 or oracle 11g ...

How to evict or "kill" open connections when these are above a fixed limit (using dbcp w/ oracle)

Hi all, Does anyone know how to evict or kill open connections (in use or not it doesn't matter) if the number of connections is above of a fixed limit (e.g. maxActive) Currently I'm using DBCP from Apache under a Sun One 6.1. Thanks in advance!, ...

Alter Type: add attribute if it doesn't already exist

Is there a way to alter an object type to add an attribute only if it doesn't already exist? I am writing a script that will be run on multiple databases. I'm trying to avoid unnecessary PLS-00410 errors (duplicate fields in RECORD,TABLE or argument list are not permitted). Something like the following: ALTER TYPE employee ADD ATTRIBUT...

Cannot connect to Oracle DB from Java - ORA-12560: TNS:protocol adapter error

Hello, This is my first Java application I am creating (using Eclipse IDE) and the second Oracle based app (I'm a .NET/MSSQL guy for years). The first Oracle app I wrote in .NET did not have any issues, and I'm trying to connect to the same server. I have installed: 'Java 2 Platform, Enterprise Edition 1.4 SDK' 'Java DB `10.5.3.0' -'...

Efficient retrieval of overlapping IP range records via a single point.

I have a table with millions of IP range records (start_num, end_num respectively) which I need to query via a single IP address in order to return all ranges which overlap that point. The query is essentially: SELECT start_num , end_num , other_data_col FROM ip_ranges WHERE :query_ip BETWEEN start_num and end_num; Th...

shell script to find filename & line count of each file, now insert this record into Oracle table.

Hi, I have to find the filename available in a folder with each file line count. And then, i will have kind of two column data. Now i have to insert this record into a oracle table having two column(col1, col2). Can i write a shell script which will do both. I found here itself of writing the first part. i.e wc -l *| egrep -v " ...

invalid sql statement in servlet

In login page i make validation that user is allowed to enter system , i make methode which validate user: boolean isValidUser(Connection con,String userName,String pass ){} it works correctly in desktop Application, but when i tried it in servlet it makes exception that table or view doesn't exist ??? but the table is aleady exist...

How can I return multiple identical rows based on a quantity field in the row itself?

I'm using oracle to output line items in from a shopping app. Each item has a quantity field that may be greater than 1 and if it is, I'd like to return that row N times. Here's what I'm talking about for a table product_id, quanity 1, 3, 2, 5 And I'm looking a query that would return 1,3 1,3 1,3 2,5 2,5 2,5 2,5 2,5 Is this possi...

Does ALTER INDEX REBUILD ONLINE render indexes invalid?

Am workin in oracle 11g. Does ALTER INDEX REBUILD ONLINE render indexes invalid when executed parallely? ...

Oracle 11GR2 deprecated XPath 1.0 functions

According to this whitepaper: http://www.oracle.com/technetwork/database/features/xmldb/xmlqueryoptimize11gr2-168036.pdf Starting 11gR2, Oracle has deprecated many older proprietary mainly XPath 1.0 based operators in favor of standards based XQuery syntax, as listed in Table 1 below. OLD ORACLE PROPRIETARY SYNTAX --> NEW XQUERY SQL/X...

Call Oracle stored procedure from ASP VBscript

I have found the following ASP VB code from Microsoft Support, and as it is stated it should print in my browser the parameters that are required from my called stored procedure. I get the following error when I run it in my browser: Microsoft OLE DB Provider for Oracle (0x80040E14) ORA-06550: line 1, column 7: PLS-00306: wrong number o...

OracleConnection lifetime - best practises

I am using the standard Oracle driver to connect to the database, but I can't really agree with my colleagues on the lifespan of OracleConnection. Is it expensive to create? Is it thread safe? Can I reuse it between request, or should I create a new one for every request? I would be grateful for a bit more detailed explanation which way...

Oracle scheduled job fails

Hi I am using Oracle 10g and using following script to create the job CREATE OR REPLACE PROCEDURE archtemp AS BEGIN UPDATE ARCH_TEMP SET ARCH_DATE = SYSDATE; COMMIT; END archtemp; VAR jobno NUMBER; BEGIN DBMS_JOB.SUBMIT(:jobno, 'archtemp;', SYSDATE, 'sysdate + 1/1440'); COMMIT; END; The job never executes automatically...

How do I execute queries with multiple lines using QOCI (the Qt Oracle binding)?

I am using the QOCI binding to connect Qt with an Oracle 10g database. The code is really simple: QSQLQuery sqlQuery = QSQLQuery(database); sqlquery.prepare(querystring); sqlQuery.exec(); Now if querystring is only one line, it works: select * from dual But if it contains multiple lines, I get an ORA-911 invalid character: select ...

error qreating qci plugin for QT, mingw32-make error

hi, i'm trying to create QCI plugin so i can connect my ORACLE db but fails... following those stages: set INCLUDE=%INCLUDE%;c:\oracle\oci\include set LIB=%LIB%;c:\oracle\oci\lib\msvc cd %QTDIR%\src\plugins\sqldrivers\oci qmake -o Makefile oci.pro mingw32-make i get this error: C:/Qt/2010.02.1/qt/src/plugins/sqldrivers/oci/../../../...