oracle

Should I use TNSNAMES.ORA or tnsnames.ora?

I'm trying to connect to Oracle from OS X. I have this file here: /usr/local/oracle/network/admin/TNSNAMES.ORA Online I've seen references to this file with the filename in both upper and lower case. Which is correct? ...

Proper way to set ORACLE_HOME?

On OS X should my ORACLE_HOME env variable be... /usr/local/oracle or... /usr/local/oracle/instantclient_10_2 ...

How do you use telnet to check a connection to Oracle?

I've been trying to get sqlplus to connect to Oracle from my OS X machine. I asked another question about it here. One person suggested that I try telnet. Consulting the man page, I tried: [ ethan@gir ~ ]$ telnet DBHOST:1521 Trying xxx.xxx.xxx.xxx... telnet: connect to address xxx.xxx.xxx.xxx: Operation timed out telnet: Unable to conn...

How to permit update of a view's results in Oracle?

I understand that database views are read-only, or at least read-only by default. Is it possible to enable the change of data brought by an oracle view? Rephrasing: If I make a view of just one table, just to hide some columns, will changes to this data be updated on the table? ...

Why does my query produce error "ORA-00933: SQL command not properly ended"?

My query: CREATE VIEW cambiodatos AS SELECT a.last_name||','||a.first_name AS "Nombre", a.salary AS "Salario", b.name AS "Nombre Departamento", c.name AS "Nombre de Region" FROM s_emp a, s_dept b, s_region c WHERE a.dept_id = b.id AND b.region_id = c.id UPDATE cambiodatos SET name = 'North Am...

installing Oracle Instantclient on Linux without setting environment variables?

Oracle's instructions specify setting LD_LIBRARY_PATH. This makes my application dependent on random users' configuration and is very troublesome to set up. How can I avoid having to set any environment variables? http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxx86_64soft.html related note for OS/X: http:...

How to configure Ruby on Rails with Oracle?

There's several pages on the net that discuss this, but most are out of date or inaccurate in some what. What's the scoop? ...

Oracle: what is the "instantclient" connection string format?

and how does it differ from the regular connection string? update: name/pass@//host:1521/instance ...

Return multiple counts with single PL SQL Query

I have the following two PL/SQL Oracle Queries that return a count: SELECT count(*) INTO counter_for_x FROM Table_Name WHERE Column_Name = 'X'; SELECT count(*) INTO counter_for_y FROM Table_Name WHERE Column_Name = 'Y'; Is it possible to write a single query that returns both the counts and populates the respective counter ...

ORA-01654: unable to extend index

Calling all Oracle Gurus! I am in the process of clustering a well tested application on WebSphere. The application in question made it about half way through processing 1k of JMS messages from a queue before this happened. ---- Begin backtrace for Nested Throwables java.sql.SQLException: ORA-01654: unable to extend index DABUAT.INDEX1...

Finding the lowest value in a table greater than a certain value

Say I have the following data Name Value =============== Small 10 Medium 100 Large 1000 Imagine that these represent the volumes of boxes. I have some items that I want to put in the boxes, and I want the smallest box possible. I need an SQL query that will: Return the row with the smallest row greater than my ...

Why does this table-creation script give me errors?

CREATE TABLE DEPARTMENTS ( dept_num NUMBER (8) dept_name VARCHAR2 (20) NOT NULL, dept_loc VARCHAR2 (25), dept_phone CHAR (13), CONSTRAINT dept_num_pk PRIMARY KEY (dept_num) ) ; ...

What is the best way to search the Long datatype within an Oracle database?

I am working with an Oracle database that stores HTML as a Long datatype. I would like to query the database to search for a specific string within the HTML data stored in the Long. I tried, "select * from TABLE where COLUMN like '%form%'". This causes the following Oracle error because "like" is not supported for Long datatypes. O...

Since SQL Server doesn't have packages, what do programmers do to get around it?

I have SQL SERVER database that have a huge proliferation of stored procedures. In my Oracle databases it's not a problem because Oracle supports packages. Even if SQL Server didn't support the cool features of packages like State and encapsulation, what do programmers do to get around this obvious deficiency? ...

Validate if a column has a null value

Which SQL would be faster to validate if a particular column has a null value or not, why? 1) SELECT * FROM TABLE1 WHERE COL1 IS NULL Execute this query and then check if you are able to read any records. If yes there are null values. 2) SELECT COUNT(COL1) FROM TABLE1 WHERE COL1 IS NULL Read the count which is returned to determine i...

ADO.NET, Closing an OracleConnection without prior Commit or Rollback: Will it leak?

Suppose I am doing the following: using (OracleConnection conn = new OracleConnection(connStr)) { OracleTransaction trans = conn.BeginTransaction(); OracleCommand command = new OracleCommand(cmdTxt, conn, trans); // this statement is executed in a transaction context: command.ExecuteNonQuery(); } // the using statement w...

Performance overhead of adding a BLOB field to a table

I am trying to decide between two possible implementations and am eager to choose the best one :) I need to add an optional BLOB field to a table which currently only has 3 simple fields. It is predicted that the new field will be used in fewer than 10%, maybe even less than 5% of cases so it will be null for most rows - in fact most of...

Oracle / Python Converting to string -> HEX (for RAW column) -> varchar2

I have a table with a RAW column for holding an encrypted string. I have the PL/SQL code for encrypting from plain text into this field. I wish to create a trigger containg the encryption code. I wish to 'misuse' the RAW field to pass the plain text into the trigger. (I can't modify the schema, for example to add another column for th...

Dynamically Populating an Oracle Cursor in a Stored Procedure

I need to dynamically populate an Oracle cursor (Oracle 10g). The SQL statement changes, based off of the input value to pull from different tables, and columns. What I don't want to do is have to maintain a temporary table that I truncate and load everytime the sproc is executed. Here is what I am currently doing, but if there is ano...

Moving data between oracle and sql server using Linked server

Hello Everyone, I have set up Oracle Linked server on Sql Server 2005 box using Oracle provider oledb and its working fine from sql server 2005 to oracle 9i, i.e. When i run distributed query from sql server i get data from oracle server to sql server. Now I don't have any clue how do i run distributed query from Oracle server and get d...