plsql

Update only date on datetime field on Pl/SQL

So i need to update some dates on an Oracle Database, the field is a datetime, but i only want the date updated and leave the time as it is... There query goes like this: update table SET field = to_date('07312010','MMDDYY'); But it's overriding the hours, minutes and seconds from the field, i want to update the date but i want th...

How do I retreive Oracle DBMS_Output from a vb.net application

I'm working on a vb.net application that executes an Oracle stored procedure. The stored procedure displays a value using dbms_output.put_line. How do I retrieve that value from the oracle database into my vb.net code? ...

Oracle Query Optimization Help - Multi Pass

I need to query the orders table to get a count of all orders for yesterdays transactions, grouped by the ship date. Then I need to have an additional column to give the total orders for the ship date for all transactions. When I added this second column, time of processing grew exponentially (which was expected) to 109s. Is there any...

PL/SQL Editor..

Can you suggest me some free and good PL/SQL Editor? I find PL/SQL developer quite good but its not free. ...

Missing Parenthesis

Here is the script I am running DROP SEQUENCE S_JobStatus; CREATE SEQUENCE S_JobStatus INCREMENT BY 1 START WITH 1 NOMAXVALUE NOMINVALUE ; -- -- TABLE: JobStatus -- DROP TABLE JobStatus; CREATE TABLE JobStatus( Id NUMBER(10, 0) NOT NULL, ShortName NUMBER(10, 0) NOT NULL, Descripti...

Need help using sql join to convert rows to columns (Oracle 9i)

Hi, I have a table, with abt 22 columns and 6-7 thousand rows in the following format Seq_num unique_id name ... ------------------------------------ 1 1 abc 1 1 cde 2 1 lmn 2 1 opq 3 1 pqr ...

Error Handling in an Oracle Script

I have been trying to figure this out for a little while now and I think it is time to ask for help.. I am building a schema provisioning script and I want to add some script output and error handling. The idea is that the script output window would only show me key messages without all the noise. Create Temporary Error Table Begin Tr...

Is there any easy way to save BLOB into client-side file system in Oracle?

Is there any easy way to save BLOB as a binary file into client-side file system with using of only standard Oracle utilities (such as sqlplus or sqlldr for example)? I've already looked onto UTL_FILE package, but actually I have two problems with it: I have doubts that it can work with client-side file system. I have no privilege to...

Problem with trigger in oracle

I'm new in oracle and i don't know what is wrong with this trigger: CREATE OR REPLACE TRIGGER "propuesta_casas" BEFORE INSERT ON "PROPUESTA_TIENDA_BARRIO" FOR EACH ROW WHEN (new."CASASCAL" IS NULL) BEGIN SELECT PROPUESTA.CASAS INTO :new."CASASCAL" FROM PROPUESTA WHERE PROPUESTA.IDPROPUESTA=new.IDPROPUESTA ; END; / Er...

Oracle query problem

Please let me know why this query is not working together. They are working separately: ( (select item_name, sum(p_qty) from stock where p_date between '08/06/2010' and '08/07/2010' group by item_name) - ( select item_name, sum(p_r_qty) from stock where p_r_date between '08/06/2010' an...

SQL finding person entry has the most dogs

person(id, dogs) how would I find the person with the most dogs select * from person p1 where p1.id in ( select p2.id from person p2 where p1.id = p2.id having count(dogs > ( select p3.id ...etc am I on the right track or will this not work? thanks for taking a look ...

What's the most efficient way to check if a record exists in PL/SQL?

A) select decode(count(*), 0, 'N', 'Y') rec_exists from (select 'X' from dual where exists (select 'X' from sales where sales_type = 'Accessories')); B) select decode(count(*), 0, 'N', 'Y') rec_exists from (select 'X' from sales where sales_type = 'Accessories'); C) ...

In a PL/SQL procedure, how do I pass a table name as a parameter?

CREATE PROCEDURE A(tab IN <table - what should I write here?>) AS BEGIN INSERT INTO tab VALUES(123); END A; How can I specify that the parameter tab is a table name? ...

Trigger is invalid and failed re-validation

Here is the code that I use to create a table, a sequence and a trigger DROP TABLE CDR.ExtDL_JobStatus; -- -- TABLE: CDR.ExtDL_JobStatus -- CREATE TABLE CDR.ExtDL_JobStatus( Id NUMBER(38, 0) NOT NULL, ShortName NUMBER(38, 0) NOT NULL, Description NUMBER(38, 0) NOT NULL, CONSTRAINT PK_ExtD...

How do I use dynamic SQL to declare a column name derived from a table name?

Building on Tony's answer on this question: If I want to do something like this, CREATE PROCEDURE A(tab IN VARCHAR2) IS tab.col_name <column> --static declaration (column name always remains the same) BEGIN EXECUTE IMMEDIATE 'INSERT INTO ' || tab(col_name) || 'VALUES(123)'; END A; How can I use Dynamic SQL in the above case? ...

get string from right hand side

I am writing a query in Oracle. I want to get a string from the right hand side but the string length is dynamic. Ex: 299123456789 I want to get 123456789 substr(PHONE_NUMBERS,-X,Y) X is different for each record. I tried this: substr(PHONE_NUMBERS,-length(PHONE_NUMBERS),Y) and it didn't work.. How can I write this query? Th...

SHOW ERRORS terminates execution

I have a script to create table and related structures DROP TABLE CDR.ExtDL_JobStatus; -- -- TABLE: CDR.ExtDL_JobStatus -- CREATE TABLE CDR.ExtDL_JobStatus( Id NUMBER(38, 0) NOT NULL, ShortName NUMBER(38, 0) NOT NULL, Description NUMBER(38, 0) NOT NULL, CONSTRAINT PK_ExtDL_JobStatus PRIMA...

How to replace specific values in a oracle database column?

I am looking to replace values in a particular column. For example the following column values column name ---------- Test1 Test2 Test3 Test12 Test14 should be (replacing est1 with rest1) column name ---------- Trest1 Test2 Test3 Trest12 Trest14 I know this should be simple but not able to get the exact function. Any help is apprec...

Compiling PLSQL from command prompt (not inside sqlplus)

Hi all, is there any way compiling plsql from command prompt not by opening sqlplus and writing the command or @filename? We want to import the output to a file and parse it for a code review tool we are working on Thanks... ...

Print equivalent on Oracle PLSQL

When you execute the following block in Oracle SQL Developer set serveroutput on format wraped; begin DBMS_OUTPUT.put_line('the quick brown fox jumps over the lazy dog'); end; You get the following response anonymous block completed the quick brown fox jumps over the lazy dog I am basically trying to use PRINT so I can track prog...