SQL & PL/SQL :: Creation Of Temp Table Within Procedure

Aug 17, 2010

I need to create a temp table within a stored procedure. I want to apply some logic on the table, and then delete it when it is completed in runtime -- all inside the stored procedure.

View 13 Replies


ADVERTISEMENT

Temp Table Within A Stored Procedure

Jul 15, 2013

I'm trying to create a stored procedure that has two temporary tables within it, and then queries both them tables and inserts the results into a table. I created the script but when they try to run in on the server it wont run.

CREATE OR REPLACE PROCEDURE UpdateFIDB_SP
IS
BEGIN
CREATE GLOBAL TEMPORARY TABLE myAAAA
AS
(SELECT AAAA.1111, AAAA.2222, BBBB.3333_EXT, CCCC.4444, DDDD.5555, DDDD.6666, DDDD.7777,
DDDD.8888, AAAA.9999, EEEE.1010, EEEE.1A1A, EEEE.1B1B, FFFF.3333_LO, FFFF.1C1C,
[code]........

View 1 Replies View Related

SQL & PL/SQL :: Temp Table Within Stored Procedure

Jul 15, 2013

I have been developing in MS SQL for about 15. So I'm still getting use to the syntax and features within Oracle.I'm trying to create a stored procedure that has two temporary tables within it, and then queries both them tables and inserts the results into a table.I created the script but when they try to run in on the server it wont run.

CREATE OR REPLACE PROCEDURE UpdateFIDB_SP
IS
BEGIN
CREATE GLOBAL TEMPORARY TABLE myAAAA
AS
(SELECT AAAA.1111, AAAA.2222, BBBB.3333_EXT, CCCC.4444, DDDD.5555, DDDD.6666, DDDD.7777,
DDDD.8888, AAAA.9999, EEEE.1010, EEEE.1A1A, EEEE.1B1B, FFFF.3333_LO, FFFF.1C1C,
AAAA.1D1D
[code].....

View 7 Replies View Related

PL/SQL :: Temp Table Within Stored Procedure

Jul 15, 2013

I'm still getting use to the syntax and features within Oracle. I'm trying to create a stored procedure that has two temporary tables within it, and then queries both them tables and inserts the results into a table.I created the script but when they try to run in on the server it wont run.

CREATE OR REPLACE PROCEDURE UpdateFIDB_SP IS BEGIN  CREATE GLOBAL TEMPORARY TABLE myAAAA    AS  (SELECT  AAAA.1111, AAAA.2222, BBBB.3333_EXT, CCCC.4444, DDDD.5555, DDDD.6666, DDDD.7777,                       DDDD.8888, AAAA.9999, EEEE.1010, EEEE.1A1A, EEEE.1B1B, FFFF.3333_LO, FFFF.1C1C,                       AAAA.1D1D               FROM mySchema.FFFF_07 FFFF               RIGHT OUTER JOIN mySchema.EEEE EEEE ON FFFF.9999 = EEEE.1B1B               RIGHT OUTER JOIN
[code].........

View 10 Replies View Related

SQL & PL/SQL :: Use Local Temp Tables Within Procedure?

Nov 23, 2012

Is it possible to create local temp variable based table within sql procedures, i am planning on writing few select queies,and want to store teh result of each select to a temp variable based table.

Within sql serevr, i can create temp tables within and then later after i use teh data at teh end drop the table.

Is it possible, since i don't want to create any physical tables.

View 1 Replies View Related

Creating And Dropping Global Temp Tables Inside A Single Procedure

Aug 20, 2010

I am writing a procedure that will be called from a java wrapper.

The procedure do a lot of data manipulations and in between i am creating global temp table and saving the data into it for each request thats given as a parameter to the procedure. After all the processing i have to write the data from this global temp table into a physical table and atlast drop the temp table.

Create or replace proc_name ()

update table........

delete from ..........

CREATE GLOBAL TEMPORARY TABLE TSAAG
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50)
)

insert into............

drop table TSAAG;

End;

creating a global temp table inside a procedure is expensive...

Do we have anything like creating table before and calling the instanse of it in procedure.

Do we have any alternatives to this..

View 3 Replies View Related

Performance Tuning :: ORA-01652 - Unable To Extend Temp Segment By 128 In Tablespace TEMP

Jul 25, 2012

One of our customer have problem with following sql statement:

SELECT c.table_name, c.column_name
FROM user_tab_columns c, user_tables t
WHERE c.table_name = t.table_name
AND c.data_type IN ('CLOB', 'BLOB');

During execution it takes all the TEMP tablespace size(8GB).

I gather system stats (dbms_stats.gather_dictionary_stats(estimate_percent=>null)) but it doesn't resolve problem.Above sql statement works fine with RULE hint but I want to know what is the reason of problem with temporary tablespace.

View 10 Replies View Related

Reports & Discoverer :: ORA-01652 / Unable To Extend Temp Segment By 128 In Tablespace TEMP

Mar 7, 2011

I am trying to run on Oracle report via Oracle Application Concurrent job. Concurrent job is completing normal but I don't get anything on print out page. In log file of this request I see message 'MSG-01003: Errors =>ORA-01652: unable to extend temp segment by 128 in tablespace TEMP'. I almost doubled the TEMP tablespace in size but still I am not able to get rid of this error message.

View 1 Replies View Related

SQL & PL/SQL :: ORA-01652 / Unable To Extend Temp Segment By 128 In Tablespace TEMP

Apr 19, 2010

The below query throws an error as mention below

My PGA_AGREGATOR_TARGET = 2GB

below query is given below.

RowsPlan

1SELECT STATEMENT
1 HASH JOIN
1 MERGE JOIN CARTESIAN
1 TABLE ACCESS BY INDEX ROWID WAT_SOURCE_DATA
BITMAP CONVERSION TO ROWIDS
BITMAP INDEX SINGLE VALUE INDX_WAT_SRC_DATA_BIT

[code]....

Error Message : ORA-01652:unable to extend temp segment by 128 in tablespace TEMP

Query :

SELECT OR004.wat_id "WAT_ID",
SYSDATE "DATE_FIRST_IDENTIFIED",
SYSDATE "DATE_LAST_IDENTIFIED",
'OR-004' "RULE_REFNO",
'RISK' "RULE_TYPE",
OR004.workspace_id "WORKSPACE_ID",
OR004.workspace_name "WORKSPACE_NAME",

[code]....

View 6 Replies View Related

Unable To Extend Temp Segment By 128 In Tablespace TEMP

Apr 6, 2009

this huge report that uses inline views. I keep getting the following error message when running the script through toad. I was thinking about using the USE_HASH hints. The sql optimizer we use is very buggy in Toad. I'm using oracle database version 10.2.0.3.

I can upload explain plan if needed.

SELECT 'Project Number^Project Start Date^Project End Date^Status^Project Manager^Task Number^'||
'Task Start Date^Task Completion Date^Task Manager^Award Number^Award Short Name^Project Organization^'||
'Task Organization^Expense Code^OMB Code^Revenue Line^Burden Rate^Burden Structure^Site^Sponsor^Type^Customer^'||
'Award Type^Award Purpose^Federal Flow Thru Code^IDC Schedule Name^Total Expenditure^Direct Charges^'||
'Indirect Charges^Cost Share Charges^Total Commitments^Direct Commitments^Indirect Commitments^Cost Share Commitments^'||

[Code]...

View 5 Replies View Related

TEMP - Unable To Extend Temp Segment By 128 In Tablespace

Jul 16, 2013

I have a TEMP tablespace with autoextend on next 10M and maxsize 5120M, now my tablespace is 99.98% full. Am getting ORA-1652: unable to extend temp segment by 128 in tablespace temp error, can i use the method to increase the maxsize value to 10240M.

View 2 Replies View Related

Create Temp Table From Existing Table

Sep 2, 2010

I want to create temp table, for this i am using:

CODEcreate global temporary table help_temp
as
select * from help;

but this is creating only the table structure, not copying the table data.

View 5 Replies View Related

SQL & PL/SQL :: Option For Temp Table?

Feb 18, 2010

What is the Best option for SQL/sybase server Temp table to use/for data manipulation (Insert/update/delete) inside the procedure in oracle Other then global temporary table.

Since we are porting from SQL/Sybase to Oracle we don't want to Create too many global temporary table.

View 3 Replies View Related

SQL & PL/SQL :: Global Temp Table

Sep 2, 2010

what are minimum privilege required to create GTT (Global Temp Table)?

View 7 Replies View Related

SQL & PL/SQL :: Create Temp Table From A File

Aug 22, 2011

I'm having some trouble dealing with the PL/SQL coding. At the moment, I have a file (set of data) that is read using java. An array is created (line by line) and is passed into a temp. table, which is then called by the plsql (call PKG_xxx.PRC_xxx...) script/command for processing. Is there any way I could directly get the file loaded into plsql (into a temp. table maybe?)

The data are just numbers and letters. I already got the PL/SQL part to select the set I want for different cases. All I need is to get the file (directly or indirectly) for the procedure without going through java.

View 11 Replies View Related

SQL & PL/SQL :: Change The Temp Table Status?

Jun 21, 2011

In one of the databases, we have created more temp tables as on commit preserve rows. but i want to change the on commit preserve rows to on commit delete rows as per application requirements.I have searched the google but i didnt find any alter scripts for it.?

View 1 Replies View Related

SQL & PL/SQL :: Can Use Temp Table In Function Which Uses Ref Cursor

Dec 6, 2012

example to use temp table in function with only ref cursor.

I need to use for the reporting purpose.

View 1 Replies View Related

SQL & PL/SQL :: Replace Temp Table With Collection?

Nov 4, 2011

how I can replace gtt in the following procedure with an Oracle Collection?

gtt or Collection is more efficient?
PROCEDURE report_gen (
i_table IN NUMBER
)
IS
BEGIN
create global temporary table test_gtt (tid NUMBER(15));

[code].....

View 6 Replies View Related

SQL & PL/SQL :: Make A Trigger On Temp Table?

Dec 27, 2011

i am trying to make a trigger on temp table(emp_rec_temp), whose data will be insert into master(emp_rec) table. But not yet get the success.

create or replace trigger trig_emp_find after insert
on emp_rec_temp for each row
declare
V_STR VARCHAR2(25);
j number;

[code]....

View 5 Replies View Related

PL/SQL :: Temp Tablespace Space Due To GTT Table

Sep 3, 2012

We are using a GTT table to store the summarize data and display it on same screen(10g 10.2.0.5). Now we are facing temporary tablespace space issue very frequently as our client do not enable the auto extend on for temp table space. We have analyzed the AWR and came to know that there are 900000 inserts per hour on an average. Client DBA Claims that there are sessions(1or 2) which inserts the data in temporary table continuously for 2-3 days.

According to him one session is running from 28th Aug and problem comes on 2nd Sep and after killing the problematic session the application will work fine. Generally this problems come on weekend. I have discussed with our dev team and as per them there is no session leakage issue.

following is the insert statement:
INSERT INTO DT_CA_STNDALN_DETAILS_TMP (ORG_ID,BA_PRODTYPE_ID,MAX
TENOR,GROSSLIMIT,GROSS_UTILISATION,HAS_MDR,HAS_CLUSTER,SIGN_IN
D,GROSS_AVAILABILITY,COLLATERAL,NET_UTILISATION,DT_CA_STNDALN_DE
TAILS_TMP_VER,DM_LSTUPDDT,NET_AVAILABILITY) VALUES (:1,:2,:3,:4,
:5,:6,:7,:8,:9,:10,:11,:12,sysdate,:13) ;

View 9 Replies View Related

PL/SQL :: Using Temp Table In Real Time

Nov 16, 2012

What is the need of Temp table in Oracle ? what is the advantage of Temp table over normal table ? Is temp table a log operation one. What is the scenario of using temp table in real time ?

View 4 Replies View Related

ASM Disk Groups Creation After ASM Instance Creation

Jul 9, 2012

During ASM Disk Groups creation after the ASM instance creation, receive the following error: Disk Group ORAASMGROUP2 already exists. Cannot be created again

The Grid infrastructure was deinstall one time and still the same issue.

View 4 Replies View Related

Cursor Versus Global Temp Table

Jan 16, 2013

We had an issue with a PL/SQL package taking hours to run as a concurrent program. Database version is 10.2.0.4.0, running on Linux x86 64-bit. A tkprof'd trace file revealed the problem SQL statement to be a cursor. This one SQL statement would run for 3+ hours. I copied the SQL statement and ran it in TOAD and it completed in seconds, returning the exact same result set. To resolve the issue in the PL/SQL package I created a global temp table and ran the exact same SQL statement as an INSERT into the global temp table.

Again, instead of hours, the SQL statement completes in seconds. If I revert the change, it goes back to taking hours. I've attached the relevant sections of the tkprof showing the two SQL statements (identical other than the insert in front of one) and the resulting explain plans and performance data. I've always been under the impression that a cursor was a better option than a temp table and I've never run into a situation where the same SQL statement runs so much longer when executed as a cursor.

Attached File(s)

SQL_As_Cursor.jpg ( 274.02K )
Number of downloads: 7

Explain_for_SQL_As_Cursor.jpg ( 189.43K )
Number of downloads: 4

SQL_as_Insert.jpg ( 277.38K )
Number of downloads: 4

Explain_for_SQL_As_Insert.jpg ( 180.66K )
Number of downloads: 2

View 2 Replies View Related

SQL & PL/SQL :: Performance With Union And Global Temp Table

May 24, 2010

I have a view, which has a union. (Union is required because of the nature of the data fetched). THis view is later joined with a global temp table which holds the -say employee Id the user selects.

So at runtime there is a join with the global temp table and the view. But the performance is really bad. I have tried using various hints, like materialize, /*+ CARDINALITY(gtmp 1) */ etc.

When i query the view alone,. the performance is good. When I remove the union, the performance is good. Some how with the union- there is a full table scan on one of the joining tables.

View 7 Replies View Related

Security :: How To Get The Data Access For A Temp Table

Jul 9, 2013

How to get the data access for a temp table ?

View 5 Replies View Related

SQL & PL/SQL :: Every Record In Temp Table Getting Updated With LAST In Datafile?

Nov 24, 2010

is that my looping script updates EVERY record with the LAST record of the datafile. where it's doing this..

DECLARE....
CURSORS...
-- *****************************************************
-- C 1
-- *****************************************************
CURSOR C1

[code]...

View 19 Replies View Related

SQL & PL/SQL :: New Table Creation From Different Databases?

Apr 9, 2013

I have two tables having same name in two different databases.i have to create a new table with these two tables in a new database.

But if one table have 2 columns and another table having three columns I have to create a new table with three columns..

View 6 Replies View Related

SQL & PL/SQL :: External Table Creation

May 23, 2011

i had small query on external tables. i had (.csv) file outside the database. In this file, one column will be added monthly. i need to create the external table dynamically by adding the column for every month.

How the procedure can be created for this requirement.

View 9 Replies View Related

SQL & PL/SQL :: Add Variable Number Of New Columns To Existing Table Temp

Feb 24, 2010

I want to add a variable number of new columns to an existing table temp (with column provided).

Example:

NewColumnNo = 4
-> the columns shall be named rate_1, rate_2, rate_3 and rate_4
-> the values shall be = Column / NewColumnNo

The result shall be like this:

create table temp_res (prodid integer, rate_1 number, rate_2 number, rate_3 number, rate_4 number);
insert into temp_res values(1, 0.25, 0.5, 0.75, 1);
insert into temp_res values(2, 0.25, 0.5, 0.75, 1);
insert into temp_res values(3, 0.25, 0.5, 0.75, 1);
insert into temp_res values(4, 0.25, 0.5, 0.75, 1);
insert into temp_res values(5, 0.25, 0.5, 0.75, 1);
insert into temp_res values(6, 0.25, 0.5, 0.75, 1);
insert into temp_res values(7, 0.25, 0.5, 0.75, 1);
insert into temp_res values(8, 0.25, 0.5, 0.75, 1);
insert into temp_res values(9, 0.25, 0.5, 0.75, 1);

View 8 Replies View Related

Adding Check After Table Creation

May 23, 2009

I created a table but I want to add the Unique check to it as I forgot to apply it to the table when I created it.Is it possible to make the field Unique after having created the table or do I have to drop the table and re-create it?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved