oracle

Parameterized Queries (C#, Oracle): How to produce a more readable representation?

I am using parameterized queries in my C# code to interact with an Oracle database. What can I do to log the statements in a more readable fashion? Suppose I have a parameterized query like: INSERT INTO PERSON (ID, NAME, BIRTHDATE) VALUES (:id, :name, :birthdate) Ideally I would like to see the log entry with all parameters replaced ...

Is it ok to use oracle 11g client with a 10g server?

I am creating a .NET program that uses odp.net, specifically the 11g version. Our oracle server is running 10g. I am too late in the development process to make a change. Am I heading for trouble? Have you had any experience running 11g client against a 10g server? ...

Oracle to MySQL syntax question

Can someone show me the MySQL equivalent of the following statement (which works in Oracle 10g)? INSERT INTO VOUCHER (VOUCHER_NUMBER, BOOK_ID, DENOMINATION) SELECT a.a1, b.ID, b.DENOMINATION FROM (SELECT rownum a1 FROM dual CONNECT BY rownum <= 10000000) a, BOOK b where a.a1 between b.START_NUMBER and b.START_NUMBER+b.UNITS-1; Basica...

SQLException: fetched column value was truncated when executing while (rs.getNext())

I have a program that pulls a large dataset from Oracle 10g (10.2.0.3) using a fairly-straightforward query. You could almost call the query/logic an "export" of sorts in that it selects the columns from a table with a minimal where clause (i.e., it returns most of, if not all, the rows). The [Java] code is boilerplate that we have all...

Mixing "USING" and "ON" in Oracle ANSI join

I wrote an Oracle SQL expression like this: SELECT ... FROM mc_current_view a JOIN account_master am USING (account_no) JOIN account_master am_loan ON (am.account_no = am_loan.parent_account_no) JOIN ml_client_account mca USING (account_no) When I try to run it, Oracle throws an error in the line with "ON" self-join saying: "ORA-25154...

Creating package-level associative array in java

Is it possible to create a java representation of a package-level oracle associative array. For example, given the following: CREATE OR REPLACE PACKAGE MyPackage AS TYPE t_numbers IS TABLE OF NUMBER INDEX BY PLS_INTEGER; I find I cannot write the following java: ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("M...

Oracle 10g - An invisible column?

Hello, Is it possible to 'hide' a column in an Oracle 10g database, or prevent data from being inserted altogether? We'd prefer to have existing INSERT statements still function, but have the information NOT insert for a particular column. Also, column masking or any type of encryption is not preferred. Not sure if it's possible, but ...

Copy record to another table adding fields

Hi, i have 2 tables: tab1 (field1, field2, field3) tab2 (field1, field2,field3, field4) I want to copy a record from tab1 to tab2 taking all the fields and adding a value for field4. How can i select field1, field2 and field3 from tab2 and also add a value? I know that SELECT and VALUES in a INSERT query are mutually exclusive. I'm work...

OracleDataReader loses results after examination

I have come across a quirky "feature" in Visual Studio and I was interested in seeing if anyone else had noticed this. Or if it is specific to myself. I have some methods that perform SQL queries on a database and then return an OracleDataReader method() { OracleCommand cmd = new command(query, connection); OracleDataReader r = cmd.Exe...

Is there a method in PL/SQL to convert/encode text to XML compliant text?

Background: I have a collegue who needs to convert text from a PL/SQL method into XML compliant text, as he is constructing a excel spreadsheet by updating a text template. ...

Better way to structure a PL/SQL IF THEN statement ?

Just wondering if there is a better way to write the following PL/SQL piece of code in ORACLE ? IF(p_c_courtesies_cd is not null OR p_c_language_cd is not null OR v_c_name is not null OR v_c_firstname is not null OR v_c_function is not null OR p_c_phone is not null OR p_c_mobile is not null OR p_c_fax is not null OR v_c_email is not n...

Is this implementation SQL-92 conformant?

Tony Andrews in another question gave an example of: IF p_c_courtesies_cd || p_c_language_cd || v_c_name || v_c_firstname || v_c_function || p_c_phone || p_c_mobile p_c_fax || v_c_email is not null THEN -- Do something END IF; as a clever (if not a tad obscure) alternative to the Oracle COALESCE functi...

Export basic sales data from JD Edwards

JD Edwards is sales and accounting software sold and supported by Oracle. We need to get daily or weekly exports from an affiliate using JD Edwards, which I can then import into our system. That means I don't want any answers that result in some sort of proprietary format. Surely there is an "Export" button, or a way to save reports a...

passing a datatable as a field from Oracle to .NET

In a .NET Datatable, the columns are Object types, which can include a datatable as a valid type for a column. So you can create a fairly complex structure: CompanyID (Integer) | CompanyName (String) | OrderRecords (DataTable) --------------------------------------------------------------------------- 1 | Acme Corp. ...

Is it possible to kill a single query in oracle without killing the session?

I would like to be able to kill a user's query in Oracle 10.2.0.4 without killing their entire session. This would allow the query to end, but not log that user out of their session, so they can continue making other queries. Is this possible at all? Or is the blunt hammer of killing the session the only way to go about ending a query...

Selecting the distinct values from three columns with the max of a fourth where there are duplicates

I have a table with one numeric value (n) and three string values (a,b,c). How do I query this table so that I get only distinct values of (a,b,c) and if there are duplicates, take the maximum of the corresponding set of n values? ...

What is the best approach for decoupled database design in terms of data sharing?

I have a series of Oracle databases that need to access each other's data. The most efficient way to do this is to use database links - setting up a few database links I can get data from A to B with the minimum of fuss. The problem for me is that you end up with a tightly-coupled design and if one database goes down it can bring the cou...

Oracle's ADF-Faces better than generic JSF? ...smells funny to me.

My developers would like to use Oracle's ADF-Faces rather than generic JSF. The advantages of "drag and drop" programming smells funny to me. Reminds me too much of the 4GL application environments of the early 90's that collapsed when you tried to extend outside of the box that they had drawn around you. Great productivity inside the...

How can I combine multiple rows into a comma-delimited list in Oracle?

I have a simple query: select * from countries with the following results: country_name ------------ Albania Andorra Antigua ..... I would like to return the results in one row, so like this: Albania, Andorra, Antigua, ... Of course, I can write a PL/SQL function to do the job (I already did in Oracle 10g), but is there a nicer,...

How do I limit the number of rows returned by an oracle query?

In mysql, I do this: select * from sometable order by name limit 10,20 In which case I get the 21st to the 30th rows (skip the first 20, give the next 10). The rows are selected after the order by, so it really starts on the 20th name alphabetically. In Oracle, the only thing people mention is the rownum pseudo-column, but it is eva...