oracle

What fails in this row level trigger?

I have this trigger: create or replace trigger t_calctotal after insert or update on item_fornecimento REFERENCING NEW AS NEW OLD AS OLD for each row begin if inserting then dbms_output.put_line(' On Insert'); update fornecimento f set f.total_enc_fornec = f.total_enc_fornec +:NEW.prec_total_if where f.id_fornecimento = :NEW.id...

Date of max id: sql/oracle optimization

What is a more elegant way of doing this: select date from table where id in ( select max(id) from table); Surely there is a better way... ...

Book about oracle and asp.net

Hi, I am new to ASP.NET and Oracle. I was looking for a book that will provide step by step guide to develop asp.net applications with oracle database. Could you please let me know about books that I should start with? Thank you. ...

Cannot save clob data type in database (Struts, Spring, Hibernate)

@Column(name="transpired") @Lob private String transpired; public String getTranspired() { return transpired; } public void setTranspired(String transpired) { this.transpired = transpired; } I tried using the following code in our model class. Transpired is a field with long text messages (reports). When viewing the "report", i...

How to Execute stored procedure from SQL Plus?

I have a stored procedure in oracle and want to test it from SQLPlus. If I use execute my_stored_proc (-1,2,0.01) I get this error PLS-00306: wrong number or types of arguments in call to my_stored_proc The beginning for the proc is this create or replace PROCEDURE my_stored_proc ( a IN NUMBER, b IN NUMBER, c IN NUMBER, ...

VB6 call Oracle procedure error

We have a lagacy VB6 app that uses an ODBC connection to a Oracle 10g DB. We are upgrading to a 11g drivers on our SOE and parts of the app have issues. Works fine with a 9.2 driver. Oracle Client 10g/11g does not like lower-case calls. This is evident in the fact that the calls that succeed are in upper case and the calls that failed a...

Oracle Data Versioning/Partitioning Strategies/Best Practices

Hi there, not sure if the subject entirely conveys what I'm trying to achieve, but let me explain: We are building an application that uses Oracle as storage backend. Each year, last years dataset will be "Archived", and a new instance created and populated from scratch. What are the options to do this within the same schema? Keep ve...

Getting unused unique values on a SQL table

I've got a table which have a column describing a numeric ID, which is unique for all the rows (but it's not the primary key). The numeric ID are limited (let's say for the answer that can be from 1 up to 10) SELECT ID FROM TABLE; ID --- 1 2 5 I've got to present to the user (via a UI) the unused values to let choosing a correct...

Oracle Number Data-Type

Hello Guys Just got a little question when a column got the Datatype Number(6,3) will this work? 1234 1234.23 12345 123456 btw google didnt help me :/ ...

scope of raise exception, handling your own exceptions in PLSQL code

I have this procedure: create or replace PROCEDURE CONVERTE IS CURSOR oldemployees IS SELECT * FROM emp1 WHERE data_saida= NULL; new_ndep emp1.num_dep%type; bi_inexistente EXCEPTION; dep_inexistente EXCEPTION; employeeNr emp1.num_empregado%type; BEGIN FOR old_emp IN oldemployees LOO...

getting request timeout exceptions from a asp.net application using the Oracle client with multiple schemas

We have an asp.net application that uses the Oracle client. In the connection string, we specify the 3 basic attributes: data source, User Id, and Password. We are using connection pooling. Our data resides in 2 different Oracle schemas. Most of the requests are for data from Schema1. The timeouts are coming from calls for data from...

Get Oracle Database name

Hi, How can I programmatically get the name of the Oracle database I am connecting to? I tried: using (OracleConnection connection = new OracleConnection(oraConnectStr)) { connection.Open(); return connection.Database; } but it returns empty string. I can't use the whole connect...

Oracle table(s) data to INSERT statements with JAVA

Hi, How can I get sql inserts from a oracle table with JAVA? Is there a Oracle API for it? I need to store it in a file, the result file should have these examples lines: -- INSERTING into TEST Insert into "TEST" ("CODE","FAMILY","SUB_FAMILY","SEVERITY","STATUS","ANOMALY_DATE","DESCRIPTION", "COMMENTS","VALUE0","VALUE1","VALUE2","VALUE...

Why does this 'modify table' statement fail?

I'm trying to add a 'not null' constraint to a column in Oracle 9. ALTER TABLE user_roles modify group_id varchar2(36 char) set not null; However, the operation fails with an odd error: Error report: SQL Error: ORA-12987: cannot combine drop column with other operations 12987. 00000 - "cannot combine drop column with other operation...

Migrating from SQL Server to ORACLE ¿what to do with temporary tables?

Currently we use SQL Server and we have A LOT (read around 5.000) different scripts that create on the fly temporary tables. Now we are migrating to ORACLE, so we cannot create on the fly temporary tables. Any ideas? Thanks in advance ...

Control Oracle Forms with outside program

I work at a company that uses the Forms based Oracle 11i. A lot of employees complain of the redundancy of data entry and I want to write a program that will ease some of that pain since all attempts to ask IT to do it have failed. The problem is, since Oracle Forms are Java based there are no "controls" as there would be on say a wi...

Cursor design and refactoring question

I have many cursors that all return rows with the same fields: a numeric ID field and an XMLType field. Every time I access one of these cursors (each cursor has now got its own function for access), I go through the same pattern: --query behind cursor is designed to no more than one row. for rec in c_someCursor(in_searchKey => local_se...

Oracle UPDATE Question

Can the update described below be completed in one UPDATE statement? I want to update the Operators.name_id values with the Users.name_id values by joining on Users.name = Operators.op_name. Both Users.name and Operators.op_name are have a unique. I know the situation described below doesn't follow "best practices", but it's a much si...

Inserting data in oracle database using php.

The following code is generating this Warning: oci_execute() [function.oci-execute]: ORA-00911: invalid character in F:\wamp\www\SEarch Engine\done.php on line 17 the code is... <?php include_once('config.php'); $db = oci_new_connect(ORAUSER,ORAPASS,"localhost/XE"); $url_name=$_POST['textfield']; $keyword_name=$_POST['textarea'];...

ORA-30483: window functions are not allowed here

Does anyone know how to get around this error ? this sql works fine, but for the 'cumulinvoiced' partitioning function. i'm trying to add a cumulative total, but it doesn't seem to work on inline views. SELECT a.mois, a.supid, a.status, COUNT (a.status), SUM (COUNT (a.status) OVER (ORDER BY a.status, a.supid, a.dossier, a.mois)...