oracle

What are the types and inner workings of a query optimizer?

As I understand it, most query optimizers are "cost-based". Others are "rule-based", or I believe they call it "Syntax Based". So, what's the best way to optimize the syntax of SQL statements to help an optimizer produce better results? Some cost-based optimizers can be influenced by "hints" like FIRST_ROWS(). Others are tailored for O...

Efficient way to update all rows in a table

Hi, I have a table with a lot of records (could be more than 500 000 or 1 000 000). I added a new column in this table and I need to fill a value for every row in the column, using the corresponding row value of another column in this table. I tried to use separate transactions for selecting every next chunk of 100 records and update t...

SQL query to translate a list of numbers matched against several ranges, to a list of values

I need to convert a list of numbers that fall within certain ranges into a list of values, ordered by a priority column. The table has the following values: | YEAR | R_MIN | R_MAX | VAL | PRIO | ------------------------------------ 2010 18000 90100 52 6 2010 240000 240099 82 3 2010 250000 259999 50 5 2...

Reporting Services URL parameter problems

I have an URL to a location on the server where it can find teh report. The report works just fine if i manually refresh it. I tried using rc:ClearSession=TRUE and i also tried sending a random parameter, but the report is still not being refreshed. Any ideas? The main scenario: User eneters the page(with a grid view) User clicks on E...

How to close an oracle db connection from php on an apache server? I mean close instantly.

Usually closing a connection is simply done by oci_close($connection); or in a worse case when the php script ends the connection pass away. In my case however, I face a different behavior. If I access my application which uses PHP 5.2.8, Apache 2.2.11 and oci8 1.2.5, the connection is kept during several minutes. Actually it seems ...

Oracle: delete suddenly taking a long time

Hi We have a feed process which runs every day of the year. As part of that we delete every row from a table (approx 1 million rows) every day, repopulate it using 5 different stored procedures and then commit the transaction. This is the only commit statement that we call. All of a sudden the delete has started takign about 2 hours to ...

Oracle Uptime Query

Is there a way for a non admin user to check the uptime of an Oracle instance? I.e. I don't have sysdba privileges. ...

Spooling data to CSV truncates

Hi, I am using the below script to output data to a csv file: set heading off set linesize 10000 set pagesize 0 set echo off set verify off spool D:\OVERNIGHT\TEMP_FILES\PFRA_DETAIL_VIXEN_OUTPUT.txt SELECT TRIM(T4.S_ORG_ID)||','|| TRIM(T4.NAME)||','|| TRIM(T3.CREATION_TIME)||','|| TRIM(T5.X_HOUSE_NUMBER)||','|| TRIM(T5.X_FLAT_NUMBER...

How to call a stored procedure using a ref cursor on oracle with squirrel

Hello, I'm trying to do the same request i'm using in Toad (the store proc signature is two varchar2 parameter and one REF CURSOR parameter) Here is what I do with Toad variable myCursor refcursor; EXEC myproc('param1','param2',:myCursor ); print myCursor; I don't know how to write this with Squirrel and I have to use Squirrel. th...

Select distinct ... inner join vs. select ... where id in (...)

I'm trying to create a subset of a table (as a materialized view), defined as those records which have a matching record in another materialized view. For example, let's say I have a Users table with user_id and name columns, and a Log table, with entry_id, user_id, activity, and timestamp columns. First I create a materialized view of...

ODP.NET for Oracle in Windows 2003 Server 64-bits

We have ASP.NET framework 3.5 hosted in Windows 2003 Server 32-bits. Database: Oracle 10gR2 in Windows 2003 Server 64-bits We should use ODP.NET 10.2.0.3. Questions: - Is ODP.NET 10.2.0.3 made to connect to a 32bit or 64bit Oracle database? - Is the same for Oracle Client? ...

Oracle Unique Indexes

I was creating a new table today in 10g when I noticed an interesting behavior. Here is an example of what I did: CREATE TABLE test_table ( field_1 INTEGER PRIMARY KEY ); Oracle will by default, create a non-null unique index for the primary key. I double checked this. After a quick check, I find a unique index name SYS_C0065645. ...

Oracle index is defined identically to constraint

I am having an issue with Oracle SQL Developer where it keeps telling me my index "Index PK_TBLCASENOTE is defined identically to constraint PK_TBLCASENOTES" whenever I go to the Indexes section of my table TBLCASENOTE. I found this Oracle form post but no one seems to have a solution. This is the DDL for making the table. CREATE TABL...

passing value of sqlplus variable from one script to another.

I have a script that gets the current time, and must pass it to another script. variable v_s_time varchar2(30); exec :v_s_time := to_char(sysdate,'YYYY-MM-DD HH:MI:SS AM'); --Lots of unrelated code here variable v_e_time varchar2(30); exec :v_e_time := to_char(sysdate,'YYYY-MM-DD HH:MI:SS AM'); @"test report script.sql" :v_s_time :v_e_...

How would I do this in SQL?

Let's say I have the following tables: PartyRelationship EffectiveDatedAttributes PartyRelationship contains a varchar column called class. EffectiveDatedAttributes contains a foreign key to PartyRelationship called ProductAuthorization. If I run this: select unique eda.productauthorization from effectivedatedat...

Oracle Linked Server error: ORA-12640: Authentication adapter initialization failed

I have a linked server on SQL Server that talks to Oracle. Executing the following sql statement using Openquery SELECT * FROM OPENQUERY(finance, 'select * from KFRI.VW_XREF_PROJECTS') will get error as the following: OLE DB provider "OraOLEDB.Oracle" for linked server "finance" returned message "ORA-12640: Authentication adapter in...

Oracle Apex:Why is this dynamic action not getting triggered/fired ?

I'm using Application Express 4.0.0.00.25 ( Apex 4.0 EA2 ). I've created a simple form, with few fields. Each of the field are not direct entry, but rather a LOV picker is attached to these, and on selecting the LOV value, the id gets stored in the field. I have a dynamic action associated to the field, ( event - change in item, conditi...

How to combine specific column values in an SQL statement

There are two variables in our database called OB and B2B_OB. There are EP codes and each EP may have one of the following 4 combinations: EP OB B2B_OB --- -- ------ 3 X 7 X 11 14 X X What I want to do is to combine the X's in the fetched list so that I can have A or B value for a single EP. My conditions are: IF...

DateTime parameter when calling stored function from java code

Hi! I call stored function with such signature: FUNCTION ADDDAYS (city VARCHAR2, startDate DATE, numDays INTEGER) from java code: JdbcTemplate jt = getJdbcTemplate(); Object o = jt.execute("{? = call ADDDAYS(?, ?, ?)}", new CallableStatementCallback() { public Object doInCallableStatement(CallableStat...

Oracle Long Raw Problem.

Hi All; select utl_raw.cast_to_varchar2(DCFILE) hexchar from T_FILE ORA-00997: illegal use of LONG datatype select to_char(DOC_FILE) hexchar from T_DOC_FILE ORA-00932: inconsistent datatypes: expected CHAR got LONG BINARY My column type long raw, how to make selected varchar2 ? ...