plsql

How to generate DELETE statements in PL/SQL, based on the tables FK relations?

Is it possible via script/tool to generate authomatically many delete statements based on the tables fk relations, using Oracle PL/SQL? In example: I have the table: CHICKEN (CHICKEN_CODE NUMBER) and there are 30 tables with fk references to its CHICKEN_CODE that I need to delete; there are also other 150 tables foreign-key-linked to th...

Help with Oracle Query

I want to delete all the records where field name class="10010" from Table A and AentryId = BentryId from Table B. if i delete the entryId 12 which matches className=10010 from Table A and the same time that same id should delete from Table B also. Table A: AentryId className 12 10010 13 10011 14 10010 15 100...

Oracle: Use of notational parameters which calling functions in insert statements not allowed ?

Why does Oracle 10 R2 not allow use of notational parameters while calling functions in insert statements ? In my app, I'm calling a function in an insert statement. If use notational method of parameter passing, I get an ORA-00907: Missing right parenthesis error message INSERT INTO foo (a, b, c)...

Oracle PL/SQL: how can I use INSERT INTO but select data from different tables?

Here's what I want to do: Insert some data being passed into a procedure into a new table, but also include some data from another table too. Example: INSERT INTO my_new_table(name, age, whatever) VALUES (names.name, ages.age, passed_in_data); But that won't work. I did check another question on here, but it was a bit much for my fe...

oracle global temporary tables

I created the global temp table. when I execute the code as an individual scripts it works fine. but when I execute it as a single script in TOAD then no record was created. there was just an empty global temp table. eg. CREATE GLOBAL TEMPORARY TABLE TEMP_TRAN ( COL1 NUMBER(9), COL2 VARCHAR2(30), COL3 DATE ) ON COMMIT PRESERVE ROWS / ...

ORACLE: can we create global temp tables or any tables in stored proc?

Hi, below is the stored proc I wrote: create or replace procedure test005 as begin CREATE GLOBAL TEMPORARY TABLE TEMP_TRAN ( COL1 NUMBER(9), COL2 VARCHAR2(30), COL3 DATE ) ON COMMIT PRESERVE ROWS / INSERT INTO TEMP_TRAN VALUES(1,'D',sysdate); INSERT INTO TEMP_TRAN VALUES(2,'I',sysdate); INSERT INTO TEMP_TRAN VALUES(3,'s',sy...

PL/SQL profiler missing data

We are using pl/sql profiler to collect metrics. We noticed that on one of the environment the plsql_profiler_runs table is populated with the total execution time but the finer details that gets collected in the table plsql_profiler_data is missing. Any idea why this would be happening? We do use dbms_profiler.flush_data() before stopp...

Can compilation of several Oracle Pl/SQL package be an atomic operation?

If I deploy N pl/sql packages to Oracle DB, can I make their compilation atomic i.e. the changes in these packages will be applied after the successful compilation of all packages? ...

Inline functions in pl/sql?

I have 5 lines of code as function which is being called 100000 times is there a way to make the function inline so that I don't experienced a call overhead in PL/SQL. Oracle 9i is the version I am using. Update: The In lining of code does not have much improvement but I gained 2 seconds though. Now I am looking for efficient version of...

PL SQL Where Clause with Column/Field name being a datatype

Quick question playing with PL SQL it seems that the tables column was named as the data type NUMBER so trying to perform a query fails since the column is being recognized as a datatype instead of a column name. Anyone know how to get around this without modifying the schema? EDIT: Thanks everyone for the help yeah the issue was it ha...

Run Sql*Plus commands on Application Express

Hi, I am new to PL/SQL, I'm trying to execute the commands that I learned at the course. VARIABLE area NUMBER DECLARE radius NUMBER(2) := &s_radius; pi CONSTANT NUMBER := 3.14; BEGIN :area := pi * radius * radius; END; I understand that I can run this using SqlPlus, but I remember my teacher was running this from the web brows...

Using MyGeneration, doodads, and Oracle XE, is it possible to implement an "auto number primary key" scheme?

Hello world. Using MyGeneration, doodads, and Oracle XE, is it possible to implement an "auto number primary key" scheme? Problem facts: I am using Oracle XE. I have implemented the following table and trigger: CREATE TABLE "USERS" ( "ID" NUMBER(38,0), "USER_NAME" VARCHAR2(50), "PASSWORD" VARCHAR2(50), "EMAI...

Oracle Warning: execution completed with warning

Hi I have two tables Orders(ID,ORDERDATE,DELIVERYDATE,GOODID,QUANTITY,COLLECTIONFROM,DELIVERYTO,NOTES) and ROLLINGSTOCK_ORDER(ORDERID,ROLLINGSTOCKID,DEPARTUREDATE,DELIVERYDATE,ROUTEID) i have created a trigger to update the DELIVERYDATE in ROLLINGSTOCK_ORDER when DELIVERYDATE is updated in Orders CREATE OR REPLACE TRIGGER TRIGG...

PL/SQL function while executing throws Out Process Memory Error

I have PL/SQL function, which is programmed to sort a set of data. This function work fine without any error, when called directly as a PL/SQL Function. However, when I call this Function Via a Unix Shell Script, even though the script returns a success code and throws an Out Process Memory Error and function is actually not executed. ...

PL/SQL bulk collect into associative array with sparse key

I want to execute a SQL query inside PL/SQL and populate the results into an associative array, where one of the columns in the SQL becomes the key in the associative array. For example, say I have a table Person with columns PERSON_ID INTEGER PRIMARY KEY PERSON_NAME VARCHAR2(50) ...and values like: PERSON_ID | PERSON_NAME ...

Refactoring PL/SQL triggers - extract procedures

Hello, we have application where database contains large parts of business logic in triggers, with a update subsequently firing triggers on several other tables. I want to refactor the mess and wanted to start by extracting procedures from triggers, but can't find any reliable tool to do this. Using "Extract procedure" in both SQL Devel...

advanced select in Stored Procedure

Hey i got this Table: CREATE TABLE Test_Table ( old_val VARCHAR2(3), new_val VARCHAR2(3), Updflag NUMBER, WorkNo NUMBER ); and this is in my Table: INSERT INTO Test_Table (old_val, new_val, Updflag , WorkNo) VALUES('1',' 20',0,0); INSERT INTO Test_Table (old_val, new_val, Updflag , WorkNo) VALUES('2',' 20',0,0); I...

plsql show query

Hi all, I have a small problem using oracle pl sql. I have a sql file with some cursor, etc, and the treatement fail but with no details. I have an idea about the problem (a function with parameters) but I would like to see the parameter for each call, to be able to debug, to see exactly with wich parameter fail. This is the message: D...

Difference between sql, pl/sql and sqlj

I want to know how do the 3 compare with one another? which one to use when? which can be used as a replacement of other? ...

Map data structure in pl/sql for storing key value pair?

Is there anyway to create a map data structure in pl/sql. ...