SQL & PL/SQL :: How To Use Desc Inside Block

Aug 1, 2011

how to use desc inside pl sql block?

View 16 Replies


ADVERTISEMENT

SQL & PL/SQL :: Cursor Declaration Inside Block?

Jun 30, 2011

I can't understand the following cursor declaration (inside the DECLARE of a PL/SQL block)

CURSOR c_emps IS
SELECT emp_large_ot(empno, ename, job, mgr,hiredate, sal, comm, deptno) FROM emp_large;
emp_large_ot is an object type created as
CREATE TYPE emp_large_ot AS OBJECT
( empno NUMBER
, ename VARCHAR2(10)
, job VARCHAR2(9)

[code]...

and emp_large is similar to the standard emp table

View 3 Replies View Related

SQL & PL/SQL :: Select On Dba_pending_transactions Inside Block?

May 14, 2011

While writing a procedure I went into this problem. Whenever I write Query : Select * from dba_pending_transactions It works fine.

But whenever I use same Select Query inside PL-SQL block it gives error Table or view not exist. Dba_pending_transactions is view.

SQL> declare
2 v_count number(2);
3 begin
4 execute immediate 'select count(*) from dba_ending_transactions' into v_count;
5 dbms_output.put_line(v_count);
6 end;
7 /
declare
*
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at line 4

Same error I get when i use it inside a procedure.

View 2 Replies View Related

PL/SQL :: Dynamic Execution Of Block Inside Trigger?

Jan 3, 2013

Im using the following oracle database.

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

I have one problem in trigger execution. I have a small plsql block in trigger and, I want to execute it as a dynamic way. but it is giving the error. Please find the trigger code. Here my intension is that, the column name used in trigger should be dynamic. In future, if I want to switch the column name, I have to do without modification in trigger.
The error im getting is "ORA-01008: not all variables bound".

CREATE OR REPLACE TRIGGER ETM_AR_IU
AFTER UPDATE ON
EXTERNAL_MAPPING
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW

[code]...

View 17 Replies View Related

Performance Tuning :: Tablespace With Different Block Size Inside Same Database?

Nov 25, 2011

All the analysis till now on our system proves that our system is clearly I/O bound and db sequential read is the biggest culprit.

We have even identified the index which is being affected by sequential read. I am thinking of creating a new tablespace with 32K blocksize (currently all table spaces are 8k) and migrate this index to the new space. That way, Oracle will have to do less number of reads to get the required data.

But is there anything wrong in having just one tablespace with a differnt block size? Or is there anything that I have to be watchful about while doing it?

View 14 Replies View Related

SQL & PL/SQL :: Place Insert Statement In Loop Inside Anonymous Block?

Nov 25, 2012

can we place insert statement in loop inside anonymous block?

CREATE TABLE DEP(DEPTID NUMBER(5) NOT NULL PRIMARY KEY,DNAME VARCHAR2(10),LOCID VARCHAR2(10));
DECLARE
I NUMBER(5);
BEGIN
I := 0;
LOOP
INSERT INTO DEP VALUES(&DEPTID,'&DNAME',&LOCID);
I := I+1;
EXIT WHEN I = 5;
END LOOP;
END;

View 6 Replies View Related

SQL & PL/SQL :: No Data Found Stops The Loop Action Inside Block?

Jul 1, 2013

I am trying to create an anonymous PL/SQL block to output privilege information for each of the users listed in DBA_USERS In a loop. This is my block so far (not finished):

declare
v_usr varchar2(30);
v_out_header varchar2(100);

[Code]....

The output is as follows:

***User-Role Privilege report***
-----------------------------------
username: ANDREY , profile: DEFAULT
SYSTEM privileges granted directly to the user(not through ROLE) :
no_data_found

A problem I am encountering is that for some users I have no direct privileges that are not granted through roles, And when I have the expression v_qry (which is basically "'select grantee ||'',''|| privilege from DBA_SYS_PRIVS where grantee not in (select role from dba_roles) and grantee ='||'''' ||v_usr||''''") not initialized with values because the select statement retrieved 0 results, I have the process interfered by the no_data_found error/exception.

Questions: how I can preferrably simply, avoid/overcome my problem? Some way to make the loop go on in spite of no data found? maybe something similar to NVL?

View 14 Replies View Related

Server Administration :: ORA-04030 - Split From Tablespace With Different Block Size Inside Same Database

Nov 26, 2011

i written this code i m facing ORA-04030: out of process memory when trying to allocate 16408 bytes error

/* Formatted on 2011/11/26 11:52 (Formatter Plus v4.8. */
DECLARE
row_id varchar2(50);
v_batch_id temp.batch_id%TYPE;
v_slab_id temp.slab_id%TYPE;
flag NUMBER (2);
num varchar2(50) := &row_id;

[code].....

View 1 Replies View Related

Alternative To DESC

Dec 12, 2006

For whatever reason, in PHP, DESC statements do not work. They're simply unrecognized and you get an OCI "invalid SQL statement" error. It may be some sort of security feature. I've also had the same result with the SQL scratchpad in the Java EM, but not in SQL Plus. Is there an alternative method for getting details on a table that I can use that also doesn't require being logged in as a SYSDBA?

View 5 Replies View Related

SQL & PL/SQL :: DESC All Tables

Oct 22, 2010

I am a newbie to Oracle and trying to write something to basically loop through all tables and do a DESC for each table,

I have the following code

set serveroutput on
begin
FOR cursor1 IN (SELECT * FROM ALL_TABLES where OWNER='ABC' ORDER BY TABLE_NAME)
LOOP
DBMS_OUTPUT.PUT_LINE(cursor1.TABLE_NAME);
FOR cursor2 IN (select * from cols where TABLE_NAME=cursor1.TABLE_NAME ORDER BY COLUMN_NAME)
LOOP
DBMS_OUTPUT.PUT_LINE(cursor2.COLUMN_NAME);
END LOOP;
END LOOP;
end;

Although the above code works, I would like to have the DESC TABLE_NAME instead of just displaying the column name so I can see the properties of the column.

I couldn't get the DESC part to work

View 5 Replies View Related

SQL & PL/SQL :: Asc / Desc Ordering Data

May 23, 2011

I am working on ORACLE 9I. I am ordering(ASC/DES) the data one column whose values are

SALES-1
SALES-14
SALES-15
SALES-2
SALES-3
SALES-11
SALES-12
SALES-13
SALES-4
SALES-5

When i do the ascending order dat looks like

SALES -1
SALES-11
SALES-12
SALES-13
SALES-14
SALES-15
SALES-2
SALES-3
SALES-4
SALES-5

but it should display as

SALES-1
SALES-2
SALES-3
SALES-4
SALES-5
SALES-11
SALES-12
SALES-13
SALES-14
SALES-15

View 2 Replies View Related

SQL & PL/SQL :: Desc Table That Can't Select

Nov 14, 2012

if you grant select on a table to a user then u revoke select on this table that user still can desc this table, is this ok? what if i don't want that user to desc it?

View 2 Replies View Related

9.2.0.8.0 Oracle Index Not Used In Order By Desc?

Oct 30, 2011

There are 2 setup of Oracle DB 9.2.0.8.0. There is a table T1 in both (one that is working 6.5 million rows and the other that is not working having 6.7 million rows). while doing - select * from t1 order by c1 desc; one is using index i1 and other is going for full table access.

View 1 Replies View Related

Forms :: Multi Data Block And Checkbox Field Based On Control Block

Nov 19, 2010

i have multi data block filed. and checkbox field which based on control block...My task is when i check checkbox only one field should enabled and my mouse goes to that field

e.g

item11 item21 item31 chkbox1
item12 item22 item32 chkbox2

Scenario like this :

My item field based on data block and checkbox based on control block,while i checked chkbox1 , only item31 on that current record should be enabled and i changed value only on that field

when i checked chkbox1 , my cursor goes to item31...not item32

View 12 Replies View Related

Forms :: Distribute Master Block Total Amount In Detail Block Line Wise

May 5, 2012

i have a master detail form, In Master block we have one field cheque amount and in Detail block we have field receiveable amount invoice wise. if company paid us a cheque amount we will enter this amount in Master block field Cheque amount and in detail block there will be invoice wise receivable amounts. i want to distribute the cheque amount in detail block invoice wise for example

Cheque amount in master block = 291

Invoice wise receiveable amount is as follows

Invoice No , receivable amount , Received amount

10, 196 , 0
20 , 95 , 0
30 , 54 , 0

Result should be as follows:

Invoice No , receivable amount , Received amount

10, 196, 196
20 , 95 , 95
30 , 54, 0

Received amount field should be distributed according to the receivable amount when recevied amount = cheque amount then remaining will be 0.

View 2 Replies View Related

Backup & Recovery :: Error / Corrupt Block Relative Dba / 0x01c12a58 (file 7 / Block 76376)

Jan 25, 2011

i have an error with block corruption

Error: Corrupt block relative dba: 0x01c12a58 (file 7, block 76376)

What all the ,methods I can go for if we are working on a production environment with out any down time.

I can go for dbms repair package and restore and recover

View 3 Replies View Related

Forms :: How To Read Values In A Multi Record Control Block Using Pre-insert Trigger (block Level)

Jul 24, 2010

I have a multi record control block (basically a text item displaying 6 records) where user enters values and I want to process the values using pre-insert trigger.

I want to read value in each record and then do some tasks using a pre-insert trigger before I commit the values. To navigate between the records I was using first_record, next_record, clear_record built-ins but it gives errors like "40737-illegalrestricted procedure next_record in pre-insert trigger".

View 3 Replies View Related

SQL & PL/SQL :: Specifying INTO Inside Execute Immediate?

Jun 29, 2011

The following code works

set serveroutput on
declare
a int;
begin
execute immediate 'select employee_id from employees where first_name=:ab' into a using 'Donald' ;
dbms_output.put_line(a);
end;

but this one doesn't

set serveroutput on
declare
a int;
begin
execute immediate 'select employee_id into :1 from employees where first_name=:2' using a,'Donald';
dbms_output.put_line(a);
end;

Am I not allowed to specify a bind variable with an into clause inside execute immediate ?

View 9 Replies View Related

Loop Inside Cursor

Sep 11, 2012

I have a cursor returning some value.

for each value returned by the cursor i need to traverse through 31 rows(1 row per day * no of days in the month).

E.g. if cursor returns service_name as xyz then for xyz there can be 31 rows(service may not be used on some days)

I need to go to all of them and take some values and move them to a flat file. how should that be done?

Attached File(s)
Query.png ( 20.99K )
Number of downloads: 9

View 1 Replies View Related

SQL & PL/SQL :: To Use A Function Inside A View

Sep 7, 2011

I am trying to create a view of a query that i would be using regularly...the query contains a function call in it...can i use it..

If yes when i try to do it . It gives out an oRa-01031:in sufficient privileges.

View 3 Replies View Related

SQL & PL/SQL :: Execute Immediate Inside A WHILE Loop

Jan 6, 2011

I have a dynamic query which i want to run till it return zero records.

I am using WHILE loop for that but it is giving compilation error:

The query is

execute immediate ' Delete from tbl_archive_trade_list
where deal_id in (
select deal_id from tbl_archive_trade_list where trade_id in (
select trade_id from ' || main_trade_group_table || ' where tradegroup_id in (
select tradegroup_id from ' || main_trade_group_table || ' a , tbl_archive_trade_list b

[Code]...

I want to run this Query in While loop till the above command return 0 records.

I tried giving the above statement inside WHILE loop but it is failing.

Without the WHILE loop the above statement works fine and executed properly.

View 5 Replies View Related

SQL & PL/SQL :: Using Procedure Inside Function?

Nov 8, 2011

I have question.Using procedure inside the function ?can I get better performance?

View 8 Replies View Related

SQL & PL/SQL :: Query Inside For Loop

Nov 3, 2011

i am trying to do something the following .. but I can't get the syntax correctly for the select statement inside the secondary_loop ...

EmailBodyHTML := '';
main_loop := '';
secondary_loop := '';

[Code]....

View 4 Replies View Related

View Inside The Procedure

Jun 12, 2013

I am having a view say name vw_mytable , i need to call this view inside the stored procedure it is saying as Grant execute on

usera.vw_mytable to userb;ORA-02204: ALTER, INDEX and EXECUTE not allowed for views

how do i create a store procedure to call a view from another user.Usera is having a view and i need to create procedure in userb and call usera.vw_table.

View 1 Replies View Related

SQL & PL/SQL :: How To Use NOT NULL Inside DECODE

Jun 28, 2007

DECODE(FIELD_1,NOT NULL,'working',NULL)

Is it possible to do such? else how to proceed so?

View 9 Replies View Related

SQL & PL/SQL :: Using Variable Inside A View

Mar 24, 2013

i want to put a variable inside a view. create or replace view loading as

SELECT H.ORGANIZATION_ID ORG_ID,H.HEADER_ID,H.REQUEST_NUMBER, H.DATE_REQUIRED ISSUE_DATE,H.ATTRIBUTE1,
H.ORGANIZATION_ID,L.INVENTORY_ITEM_ID,SS.SALES_ID,S.SECONDARY_INVENTORY_NAME SUB_INV_CODE,S.DESCRIPTION SALESPERSON,I.SEGMENT1 ITEM_CODE,
[code]....

i want this condition to be like and to_date(H.DATE_REQUIRED,'dd-mm-rrrr') = to_date('Vdate','dd-mm-rrrr') i want Vdate as a variable parameter.

View 2 Replies View Related

PL/SQL :: Doing DML Inside Pipeline Function

Oct 10, 2013

In the follow code example, is it possible to save the seeds that I generated into a table when I call this table function without expliciting doinginsert into <some_table>select select * from table(pkg_seed.getSeed(200)); I try the automonous_transaction clause but it does not work.  

--drop package pkg_seed--drop type seed_tab   CREATE or replace TYPE seed_rec AS OBJECT( id number,seed number);    CREATE or replace TYPE seed_tab AS TABLE OF seed_rec;    CREATE or replace PACKAGE pkg_seed IS      function getSeed(maxrow in number  default 100)    RETURN seed_tab PIPELINED;END pkg_seed;/    CREATE or replace PACKAGE BODY pkg_seed IS    function getSeed(maxrow in number  default 100)   RETURN seed_tab PIPELINED  IS   cursor cur_seed(vmaxrow number) is    select rownum id, floor(dbms_random.value(1,1000) ) seed  from dual connect by level <= vmaxrow;    l_seed cur_seed%rowtype;   BEGIN  open cur_seed(maxrow);   LOOP   FETCH cur_seed into l_seed;   pipe row(seed_rec(l_seed.id,l_seed.seed));   END LOOP;  RETURN; -- the function returns a single result      END getSeed;END pkg_seed;/    select * from table(pkg_seed.getSeed(200));

View 15 Replies View Related

PL/SQL :: Sub-query Inside IN Clause?

Jul 25, 2013

Below is the block which i am trying to test in scott schema. I dont want to substute IN clause values directly. So i have written cursor and have added in separate variable separeated by comma.But its not working.  

declares varchar2(1000);s1 varchar2(1000);v number := 0;v1 varchar2(2000) := 'SCOTT';j number := 0;cursor hhis select ename from emp;beginselect count(*) into v from emp;  for i in hh loops := s||''''||i.ename||''''; j := j+1;if j <> vthen s := s||',';end if;s1 := s1||s;s := null; end loop;dbms_output.put_line(S1); case when v1 in (s1) then dbms_output.put_line('Y');  else dbms_output.put_line('N'); end case;end;  

View 3 Replies View Related

Hyperlink Inside A Mail Got Corrupted

May 4, 2012

I have an application written in Pl SQL Oracle which suppose to send email using utl_smtp. For users that are using Exchange Server 2010 Windows the hyperlinks inside the email are correctly but for users that have a Postfix version installed on a Debian 5 Linux mail server the hyperlinks contains some extra spaces. I think that the CRLF that I'm using inside my code to create the MIME message is not ok interpreted.

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







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