SQL & PL/SQL :: Parametrized Cursor Creation

Apr 26, 2012

I have a quick question, can we create a cursor as parametrized so that it picks up the table name as an input to the procedure, but it is not compiling.

CREATE OR REPLACE PROCEDURE CORPREPRECON.D_Q_CHECK_P (IN_TABLE_NAME IN VARCHAR2 )
IS
V_NULL_CHECK NUMBER(10) := 0;
V_BLANK_CHECK NUMBER(10) := 0;
V_LEN_CHECK NUMBER(10) := 0;
CURSOR C1 IS SELECT * FROM ||IN_TABLE_NAME;
[code]......

View 15 Replies


ADVERTISEMENT

Why Parametrized Cursor Is Slow

Aug 3, 2010

WHY PARAMETRIZED CURSOR IS SLOW

I have the following query which is very slow

CURSOR c_party_ids (p_party_name VARCHAR2, p_party_type VARCHAR2, p_eval_active NUMBER)
IS
SELECT a.party_id,
a.party_type,
b.cust_account_id,
b.attribute17
[code].......

View 3 Replies View Related

SQL & PL/SQL :: Parametrized Cursor For Loop?

Apr 20, 2011

declare cursor c_abc (v_eno in varchar2,v_ename in varchar2) is
select empno,ename from emp
where empno=v_eno
and ename=v_ename;
v_eno emp.empno%type;
v_ename emp.ename%type;
begin
for re_ab in c_abc(1,'Dummy') loop
dbms_output.put_line( to_char(re_ab.v_eno)||' - '|| re_ab.v_ename);
end loop;
end;
/

I am getting error message ORA:06550
V_ENO must declared ..

Parameterized cursor for loop ..

View 3 Replies View Related

Forms :: Parametrized Cursor In Oracle Form

Dec 7, 2011

I am creating a button , on this button i call a procedure

e.g. excel

on this procedure i call parametrized cursor ...but i give me error i dont know what is this ..my code is like this

Quote:
PROCEDURE excel IS
CURSOR C2(v_link_nm varchar2) is
select alt_loc LOC, alt_inv_no INV_NO, alt_inv_dt INV_DT, alt_amt AMOUNT, alt_rvc2 ALT_RVC,
alt_doc_no DOC_NO, alt_doc_typ DOC_TYP, alt_authid AUTH_ID, alt_authdt AUTH_DT
from v_link_nm
[code]......

when i compiled i get error v_link_nm not defined...

View 1 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

Precompilers, OCI & OCCI :: Pro*C - Cursor Leak With Cursor Array

Sep 7, 2007

I'm dealing with an ORA-1000 error in a Pro*C application where all the cursors are correctly closed (or so it seems to me).

Here is the code for a simple program which reproduces the problem:

Each cursor is opened in a PL/SQL package:

CREATE OR REPLACE PACKAGE emp_demo_pkg AS
TYPE emp_cur_type IS REF CURSOR;
PROCEDURE open_cur(curs IN OUT emp_cur_type, dept_num IN NUMBER);
END emp_demo_pkg;

[Code]....

While testing the initialization parameter open_cursors is set to 50.

It's my understanding that Oracle doesn't close the cursors until it needs the space for another cursor, which in my test case seems to happen when I enter a value of 50 or bigger for "number of loops". To see how oracle is reusing the cursors, while the test program is running I run SQL*Plus and query v$sesstat for the session that's running the test with the following sentence:

select name, value
from v$sesstat s, v$statname n
where s.statistic# = n.statistic#
and sid = 7
and name like '%cursor%';

Even before I enter a value for number of loops I can see that the session opened 4 cursors and closed 2 of them:

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 4
opened cursors current 2

Entering a value of 5 for number of loops yields

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 11 <----- 7+
opened cursors current 8 <----- 6+

With a value of 30

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 36 <----- 25+ (apparently, Oracle reused at least 5 cursors)
opened cursors current 33 <----- 25+

With a value of 47

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 53 <----- 17+
opened cursors current 50 <----- 17+

Now I reached the upper limit set by the initialization parameter open_cursors.

Entering a value of 48, I get the ORA-1000 error.

ORA-01000: maximum open cursors exceeded
ORA-06512: at "SCOTT.EMP_DEMO

Since I open and close the cursor in the same loop iteration, I expect to find in every iterarion 1 explicit cursor and a number of implicit cursors (the PL/SQL call along with the so-called recursive cursors), but I don't expect the sum of all of them to be greater than 50. If my understanding is correct Oracle should be reusing the 50 cursors previously marked as "closeable", not raising the ORA-1000 error.

View 1 Replies View Related

SQL & PL/SQL :: Cursor With Bind Variable And Cursor Record

Feb 25, 2011

Is it possible to:

-define a cursor with bind variables
-get a cursor record from these cursor
-and pass the bind variable in the OPEN clause

Did'nt succeed as shown in the example.

SET SERVEROUTPUT ON SIZE 900000;
DECLARE
--works fine
CURSOR c1 IS SELECT * FROM USER_TABLES WHERE rownum<3;
--doesn't work
--CURSOR c1 IS SELECT * FROM USER_TABLES WHERE rownum<:1;
crec c1%rowtype;
BEGIN
--works fine
OPEN c1;
--isn't possible ?
--OPEN c1 USING 3;

[Code]....

View 3 Replies View Related

SQL & PL/SQL :: Converting Numeric Cursor To Ref Cursor?

Sep 11, 2011

just looking around to use the new feature available in oracle 11g to convert the dbms_sql numeric cursor to reference cursor, how to do it?

parse and execute the sql string first with dbms_sql and then convert it to ref cursor?

View 1 Replies View Related

SQL & PL/SQL :: Open Ref Cursor From Explicit Cursor

Nov 23, 2011

I want to return ref cursor based on explicit cursors

create table jumbo(id number, name varchar2(20));
insert into jumbo values(1,'jumbo');
create table mumbo(id number, name varchar2(20));
insert into mumbo values(1,'mumbo');
commit;

[Code].....

The above procedure has compilation errors when I am trying to open ref cursor

LINE/COL ERROR
-------- --------------------------------------------------------
20/24 PL/SQL: SQL Statement ignored
20/38 PL/SQL: ORA-00942: table or view does not exist
32/24 PL/SQL: SQL Statement ignored
32/38 PL/SQL: ORA-00942: table or view does not exist
SQL>

View 5 Replies View Related

PL/SQL :: Can User Exist When Cursor Will Using For Cursor

Aug 7, 2013

Can i user exist when cursor will using For Cursor .

View 15 Replies View Related

DB Creation Manually?

Oct 19, 2012

Just started to learn oracle DBA. I am creating database manually.. I am facing following errors

I executed catproc.sql script it was running suddenlt oracle throwd following error.

CODEPL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Package body created.

No errors.

Package body created.

BEGIN
*
ERROR at line 1:
ORA-01552: cannot use system rollback segment for non-system tablespace 'TEMP'
ORA-06512: at "SYS.DBMS_STATS", line 13210
ORA-06512: at "SYS.DBMS_STATS", line 13517

[code]...

Script detail's

CODECREATE  DATABASE drprod
       LOGFILE GROUP 1 ('/u01/app/oracle/oradata/drprod/redo01.log') SIZE 100M ,               GROUP 2 ('/u01/app/oracle/oradata/drprod/redo02.log') SIZE 100M
  MAXLOGFILES 5
  MAXLOGMEMBERS 5

[code]...

View 14 Replies View Related

SQL & PL/SQL :: Creation Of Package

Jan 12, 2011

Why Package has to be created as two parts

1) Package spec
2) Package Body ?
Quote:PLS-00304: cannot compile body of '<PACKAGE_NAME>' without its specification

I learned it as a Thumb of rule! But IF there is any rule for it give that URL/link for that.

View 25 Replies View Related

Index Creation Estimates

May 13, 2013

I have a quiet large table (around 140 GB) and i want to create an index on it. I was wondering, before i fire my my create index statement, i know in advance how long will it take to complete? I know after the create index is executed, we can monitor and gets some estimates from longops view. but is there any way we estimate before hand?

Also my database is in archive log mode and what would be the fastest way to create an online index?

View 5 Replies View Related

ASM Diskgroup Creation Failed

Apr 12, 2011

i am trying to create the ASM diskgroup means it's giving the below error.

[root@racdb3 ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb6
Marking disk "VOL1" as an ASM disk: [FAILED]

View 4 Replies View Related

Automatic User Creation

Apr 15, 2012

I am doing my master project on oracle Database. I need to create a PL/SQL script to create user automatecally. Name of the users i am supposed to get from some table (say pr_id of table persons).

View 4 Replies View Related

SQL & PL/SQL :: Creation Of Sequence To Varchar

Dec 7, 2011

how to create sequence to varchar and how see that sequence

View 2 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

PL/SQL :: Materialized View Creation?

Jun 15, 2013

I am running into an issue and trying to ascertain issue.  Scenario:I have 2 MV creation scripts. The MV is supposed to get populated by connection from schema to another schema USING DB Links.Basically, SAME HOST, SAME RAC DATABASE, just separate schemas.  The MV creations are just hanging. I see NO alert log mentions. I ran  a SQL trace and yes,

I see:  call count       cpu elapsed       disk query    current        rows------- ------  -------- ---------- ---------- ---------- ----------  ----------Parse 0      0.00 0.00 0          0 0           0Execute   1011 1.40 73.80 0 0 0           0Fetch 1010      1.08 317.57 0 0 0        1010------- ------  -------- ---------- ---------- ---------- ----------  ----------total 2021      2.49 391.38 0 0 0        1010 Misses in library cache during parse: 0Optimizer mode: ALL_ROWSParsing user id: 109     (recursive depth: 2) Elapsed times include waiting on following events:  Event waited on Times Max. Wait  Total Waited  ---------------------------------------- Waited  ----------  ------------  SQL*Net message to dblink 2022 0.00          0.00  SQL*Net message from dblink 2021 0.46        242.58    

Understandable, but when I do a selective query, the results come back pretty much within 5 seconds.DB version is 11.2.0.3.   Is there a BUG that I should know about?

 Here is a snippet:  

CREATE MATERIALIZED VIEW "SCHEMA"."MV_NAME_MV" USING INDEX REFRESH COMPLETE ON DEMAND AS (SELECT distinct mapguide_persons(pl.location_code) "FULL_NAME_COSTCENTER",mapguide_jobemp(pl.location_code) "TRUNCNAME_JOB",mapguide_empnum(pl.location_code) "FULLNAME_EMPNUMBER_PHONE",mapguide_english(pl.location_code)

[code]....

View 7 Replies View Related

PL/SQL :: How To Find Error In Pkg Creation

Apr 26, 2013

I have 30 packages to be created for a new user, i call in the execute_pkg.sql which creates all the 30 packages.

i use like this

sql> set echo on
sql> set spool execute_pkg_spool.txt
sql>@execute_pkg.sql
sql> spool off

My questions:

I find it difficult to figure out the which pkg was not created, at present the spool file is too big with the pkg code in it

create or replace package test1....
...
..
..

Warning: Package Body created with compilation errors.

i wanted the output like this

test1
Warning: Package Body created with compilation errors.

View 5 Replies View Related

SQL & PL/SQL :: Database Link Creation

Jan 28, 2013

I have installed oracle database 11gr2 in laptop1 and installed oracle database 11gr2 in laptop2.Both the laptop's are connected to same internet connection through wifi. So my question is can i create a database link between these two databases using this wifi? give some steps in creation of a database link.

View 13 Replies View Related

Trigger Creation Error

Nov 28, 2012

I am getting error while creating a trigger. I am not yet find any wrong statement. See the following code and comments.

SQL> CREATE OR REPLACE TRIGGER shclog_in before update on shclog for each row
WHEN (to_number(new.MSGTYPE) = 210)
2 3 declare
4 PRAGMA AUTONOMOUS_TRANSACTION;
5 begin
6 insert into starcas.transaction_log values(:new.PAN,
[code].......

Warning: Trigger created with compilation errors.

SQL> show error
Errors for TRIGGER SHCLOG_IN:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/1 PL/SQL: SQL Statement ignored
4/21 PL/SQL: ORA-00942: table or view does not exist
SQL>

View 4 Replies View Related

SQL & PL/SQL :: Empty Space Creation

May 29, 2013

While i am inserting data into a specific table that table assigns empty spaces.

For example:
CREATE TABLE DEALER_MST
("DEALER_CODE" CHAR(10) NOT NULL ENABLE,
"REGION_CODE" CHAR(3),
"SUB_REGION_CODE" CHAR(3),
"DEALER_NAME" VARCHAR2(80),

[Code]....

But it is giving result as DS with 8 spaces. It assigns spaces in db automatically while fetching.

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

Data Pump Index Creation

Aug 7, 2011

I am running Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production on RHEL5. I am busy with data pump import, from the log I can see that my import is busy with the constraints.

I am using parameter EXCLUDE=INDEX during the import and I created the index DDL's.

Now I want to manually create indexes while the import is busy.

Will this be advisable to do or what would be the impact?

View 1 Replies View Related

Multiple Listener Creation In Windows 7

May 5, 2011

I have window7 OS, I installed 4 ORACLE HOME's in WINDOWS7 machine,

two ORACLE_HOME is for 10.2.0.3

two ORACLE_HOME is for 11.2.0.2

My intension is to configure DATAGAURD on 10g,11g But while configuring Listeners it creating problems like as of my knowledge we have set exicutable path in envronmental veriables.

creation of Listener for 10.2.0.3 ( first ORACLE_HOME)

but while creating listerner for 10.2.0.3( seconde ORACLE_HOME)

LISTENER created but it's showing ORACLE_HOME of FIRST ORACLE_HOME

as i know we need to set parameters

SET ORACLE_HOME=
SET ORACLE_SID=

is there any setting Required before configuring LISTENER for SECOND ORACLE_HOME? and for 11g

View 3 Replies View Related

Monitor The Creation Of New Datafiles / Tempfiles?

Oct 15, 2012

I am looking for a way to monitor the creation of new datafiles / tempfiles.Let's say I am creating a new datafile of 8GB in size, and it takes a few minutes to create.

I have looked at v$session_longops, and several other system views, but cannot find any that indicate how the file creation is progressing.

I want to be able to display something simple, such as "72% complete".

View 1 Replies View Related

ASM Diskgroup Creation Failed Using Two Node

Mar 19, 2012

A am new in RAC configuration.I configuring RAC with ASM diskgroup with the external redundency. So now i am facing problem to mount the ASM diskgroup. I am giving the the RAC configuration description below.

1. using two node rac1 and rac2

2. asm disk configuration 3 drive
/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3
on both node

3. and i am using vmware to configure the both node asmdisk group

after configuring the os level and oracle clustring , i run dbca to configure asm disk group..so in the create disk screen i have found my previous create 3 disks

/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3

so first two disks

/dev/raw/raw1
/dev/raw/raw2

i named it "dg1" then press ok , when i pressed ok a warring is appear that is "could not mount the diskgroup on remote node on rac2 using the connection service rac2:1521:+ASM2. Ensure that the listener is running on this node and the asm instance is registred to the listener. Receive the following error:

ORA-15032 : not all alterations performed
ORA-15063 : ASM discovered insufficient number of disk for diskgroup "DG1"

as the same way i create another diskgroup "fg" for flash recovery area using disk /dev/raw/raw3

so after creating the two diskgroup i saw the two diskgroup is appere in the "diskgroup appere screen" an saw that only one diskgroup is mounted but not second node i.e. rac2 diskgroup is not mounted . What should i do no .

View 2 Replies View Related

Table Creation Inside Function

Feb 25, 2012

i am trying to create table inside function where in after creating table when am trying to access the table with select statement oracle is throwing error 'Table/view doesnot exist -00942', below is the code snippet

create or replace function example (mkey in varchar2) return varchar2
is
g_key varchar2(100);
l_tbl_ntext exception;
pragma exception_init(l_tbl_ntext , -942);
begin

begin
execute immediate 'select * from example1';

exception
when l_tbl_ntext then
null;
end;
execute immediate 'create table example1(skey varchar2, g_key varchar2) storage(buffer_pool, keep)';
end example;
/

select * from example;

View 8 Replies View Related

Template File Used In Database Creation?

May 15, 2012

I am having a template file (only .dbt file) to create the database instance.I Kept it in $ORACLE_HOME/assistant/dbca/template/,after running DBCA it was loaded with details mentioned in it ,but at the second last step when i try to see initialization parameters control file ,datafile and tablespace detail was not mentioned.when it started database creation ,got hanged on 5% completion showing failure in processing system parameters. Is it the right way to create database using DBCA?what should I do to create database using template?

View 1 Replies View Related







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