Split row in many rows
SELECT value FROM lsw_epv_var_value EVV
JOIN lsw_epv E ON E.epv_id = EVV.epv_var_id
AND E.name = 'AcessoTodasRegionais'
AND EVV.EPV_VAR_VALUE_ID = (SELECT MAX(EPV_VAR_VALUE_ID) FROM LSW_EPV_VAR_VALUE EVV JOIN lsw_epv E ON E.epv_id = EVV.epv_var_id AND E.name = 'AcessoTodasRegionais' WHERE EFFECTIVE_ON <= SYSDATE)
The result of the query above is
tw_admins_internal,Diretoria de Negocios Nacional,Administradores Teamworks
As you can see, the result is split by commas, I need to convert this result in many rows like below
tw_admins_internal
Diretoria de Negocios Nacional
Administradores Teamworks
How could I do that?
Thanks
Hi,
/* How to Split a Delimited String
This shows how to take a single row with a delimited string, such as
Animal amoeba,bat,cedusa,dodo
and transform it into multiple rows:
Animal 1 amoeba
Animal 2 bat
Animal 3 cedusa
Animal 4 dodo
PROMPT ========== -1. sep_char parameter ==========
VARIABLE sep_char VARCHAR2 (10)
EXECUTE :sep_char := ',';
SELECT :sep_char AS sep_char
FROM dual;
PROMPT ========== 0. string_test table ==========
DROP TABLE string_test;
CREATE TABLE string_test
( grp_name VARCHAR2 (10)
, list_txt VARCHAR2 (50)
INSERT INTO string_test (grp_name, list_txt) VALUES ('Animal', 'amoeba,bat,cedusa,dodo');
INSERT INTO string_test (grp_name, list_txt) VALUES ('Date', '15-Oct-1582,16-Oct-2008');
INSERT INTO string_test (grp_name, list_txt) VALUES ('Nothing', NULL);
INSERT INTO string_test (grp_name, list_txt) VALUES ('Place', 'New York');
INSERT INTO string_test (grp_name, list_txt) VALUES ('Skip', 'Hop,,Jump');
SELECT *
FROM string_test
ORDER BY grp_name;
PROMPT ========== Q1. Oracle 11 Query ==========
WITH cntr AS -- Requires Oracle 9
( -- Begin sub-query cntr, to generate n (1, 2, 3, ...)
SELECT LEVEL AS n -- Requires Oracle 9
FROM dual
CONNECT BY LEVEL <= 1 + (
SELECT MAX ( REGEXP_COUNT (list_txt, :sep_char) ) -- Requires Oracle 11
FROM string_test
) -- End sub-query cntr, to generate n (1, 2, 3, ...)
SELECT grp_name
, n
, REGEXP_SUBSTR ( list_txt -- Requires Oracle 10
, '[^' || :sep_char || ']' -- Anything except sep_char ...
|| '+' -- ... one or more times
, 1
, n
) AS item_txt
FROM string_test
JOIN cntr -- Requires Oracle 9
ON n <= 1 + REGEXP_COUNT (list_txt, :sep_char) -- Requires Oracle 11
ORDER BY grp_name
, n;
/* Notes:
REGEXP_SUBSTR (s, '[^,]+', 1, n)
returns the n-th item in a comma-delimited list s.
If there are fewer than n items, it returns NULL.
One or more consecutive characters other than comma make an item, so
'Hop,,Jump' has two items, the second one being 'Jump'.
The sub-query cntr produces a list of integers 1, 2, 3, ..., w
where w is the worst-case (the largest number of items in any list).
This actually counts separators, not items, (e.g., it counts both
commas in 'Hop,,Jump', even though), so the w it produces may be
larger than is really necessary. No real harm is done.
PROMPT ========== Q2. Possible Problems Fixed ==========
WITH cntr AS
( -- Begin sub-query cntr, to generate n (1, 2, 3, ...)
SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= 1 + (
SELECT MAX ( REGEXP_COUNT (list_txt, :sep_char) )
FROM string_test
) -- End sub-query cntr, to generate n (1, 2, 3, ...)
SELECT grp_name
, n
, REGEXP_SUBSTR ( list_txt
, '[^' || :sep_char || ']' -- Anything except sep_char ...
|| '+' -- ... one or more times
, 1
, n
) AS item_txt
FROM string_test
JOIN cntr ON n <= 1 + NVL ( REGEXP_COUNT (list_txt, :sep_char) -- Problem (1)
, 0
WHERE REGEXP_SUBSTR ( list_txt -- Problem (2)
, '[^' || :sep_char || ']' -- Anything except sep_char ...
|| '+' -- ... one or more times
, 1
, n
) IS NOT NULL
OR list_txt IS NULL -- Problems (1) and (2) together
ORDER BY grp_name
, n;
(Possible) Problems and Fixes
(1) If list_txt IS NULL, then REGEXP_COUNT (list_txt, :sep_char)
returns NULL, the join condition fails, and the output
contains nothing corresponding to the row from string_test.
If you want a NULL item to appear in the results, use
NVL to make sure the expression returns 0 instead of NULL.
(2) If list_txt contains multiple consecutive sep_chars (or if it
begins or ends with sep_char, then the original query
will return NULL items. To suppress these, add a WHERE
clause to test that the item_txt to be displayed IS NOT NULL.
PROMPT ========== Q3. Oracle 8.1 Query ===========
SELECT grp_name
, n
, SUBSTR ( list_txt
, begin_pos
, end_pos - begin_pos
) AS item_txt
FROM ( -- Begin sub-query to compute begin_pos and end_pos
SELECT grp_name
, n
, list_txt
, INSTR ( :sep_char || list_txt
, :sep_char
, 1
, n
) AS begin_pos
, INSTR ( list_txt || :sep_char
, :sep_char
, 1
, n
) AS end_pos
FROM string_test
, ( -- Begin sub-query cntr, to generate n (1, 2, 3, ...)
SELECT ROWNUM AS n
FROM all_objects
WHERE ROWNUM <= 1 + (
SELECT MAX ( LENGTH (list_txt)
- LENGTH (REPLACE (list_txt, :sep_char))
FROM string_test
) -- End sub-query cntr, to generate n (1, 2, 3, ...)
cntr
WHERE n <= 1 + ( LENGTH (list_txt)
- LENGTH (REPLACE (list_txt, :sep_char))
) -- End sub-query to compute begin_pos and end_pos
ORDER BY grp_name
, n;
/* Version-Dependent Features and Work-Arounds
The code above, Q3, runs in Oracle 8.1.
The following changes were made to Q1:
(11) REGEXP_COUNT was introduced in Oracle 11.
In earlier versions, to find the number of sep_chars in list_txt,
see how much the LENGTH changes when sep_chars are removed.
(10) REGEXP_SUBSTR was introduced in Oracle 10.
In earlier versions, use INSTR to find where the sep_chars are,
and use SUBSTR to get the sub-strings between them.
(Using this technique, 'Hop,,Jump' still contains three items,
but now item 2 IS NULL and item 3 is 'Jump'.)
(9.a) The WITH-clause was introduced in Oracle 9
In earlier versions, use in-line views.
(9.b) "CONNECT BY LEVEL < constant" doesn't work in Oracle 8.
Use ROWNUM from any sufficiently large table or view instead.
(9.c) ANSII join notation (JOIN table_name ON ...) was introduced in Oracle 9
In earlier versions, join condition go in a WHERE-clause.
*/
Similar Messages
-
SQL help, how to split one row into many rows
Hi,
I got a question on SQL. One table, structure like this: (2 columns)
A 123,456,789
B 012,345
C 678,901,234
How to get the final result like below:
A 123,
A 456,
A 789
B 012,
B 345,
C 678,
C 901,
C 234
Do I have to use PL/SQL? Appreciate any thought you have on it!i doubt the second column string operation can be acheived within single query to break it into rows.
but here is the pl/sql to do it.
SQL> create table test_data(col1 varchar2(5), col2 varchar2(30))
2 /
Table created.
SQL> insert into test_data values('A','123,456,789')
2 /
1 row created.
SQL> insert into test_data values('B','012,345')
2 /
1 row created.
SQL> insert into test_data values('C','678,901,234')
2 /
1 row created.
SQL>
SQL> set serveroutput on
SQL>
SQL> declare
2 pos number:=0;
3 str test_data.col2%type;
4 begin
5 for i in (select col1, col2 from test_data)
6 loop
7 str := i.col2||',';
8 loop
9 pos := instr(str, ',');
10 dbms_output.put_line(i.col1||' '||substr(str, 1, pos-1));
11 str := substr(str, pos+1);
12 exit when str is null;
13 end loop;
14 end loop;
15 end;
16 /
A 123
A 456
A 789
B 012
B 345
C 678
C 901
C 234
PL/SQL procedure successfully completed. -
How to concatenate many rows to be one row?
Hi,
How can I do if I concatenate two rows or many rows become one row in the same column with different values (CHAR or VARCHAR2). It's possible to do that?
Ex:
Column A
ABCD
EFGH
to become
Column A
ABCDEFGH....
Anybody can help me, please...
I will very appreciated.
Thanks,
LenyI'm not sure if SQL Plus supports this feature. But programmatically it is possible if you use oracle procedure. Also if you're using some front end application (like VB, ASP etc) where you need the concatenated result then you can easily concatenate all rows under a loop on Recordset.
-
Splitting multiple rows onto one row with different fields
Hi all,
I have a table. One Course_Code have multiple section_codes i.e. ("NUM" column does not relate to sectype its just an order!)
Code--------num----Sec_code---Sectype---DESC----------------WEIGHT
1603--------1-------7427-----------C------------Coursework-------- 50
1603--------2-------7428-----------E------------ Exam---------------- 50
When I query this table i want to be able to see the coursework, exam split on the same row. i.e.
Code-----Coursework---------Exam
1603-----C=50------------------E=50
any help would be greatHi,
"Splitting" means taking an item (such s a string like 'C=50') and diviiding it into smal;ler items (such as the sub-strings 'C' and '50'). Are you really trying to split something, or are you trying to do just the opposite (e.g., combine smaller strings into a bigger string)?
I think what you're looking for is a Pivot . Like so many other things, exactly how to do it depends on your version of Oracle and your requirements.
Here's one way:
SELECT code
, MIN (CASE WHEN descr = 'Coursework' THEN sectype END)
|| '='
MIN (CASE WHEN descr = 'Coursework' THEN weight END) AS coursework
, MIN (CASE WHEN descr = 'Exam' THEN sectype END)
|| '='
MIN (CASE WHEN descr = 'Exam' THEN weight END) AS exam
FROM table_x
GROUP BY code
;This will work in Oracle 8.1 and higher. Starting in Oracle 11.1, you could also use the SELECT ... PIVOT feature.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using. -
Split single row in multiple rows based on date range
I need sql script that can split single row in multiple rows based on start date and end date column in table.
Thank youI agree to your suggestion of having a dates table permanently in the database. Thats how we also do for most of our projects as well
But in most projects the ownership of table creation etc lies with the client as they will be the DBAs and will be design approval authorities. What I've seen is the fact that though
many of them are in favour of having calendar table they dont generally prefer having a permanent table for numbers in the db. The best that they would agree is for creating a UDF which will have
tally table functionality built into it based on a number range and can be used in cases where we need to multiply records as above.
Wherever we have the freedom of doing design then I would also prefer creating it as a permanent table with required indexes as you suggested.
>> many of them are in favour of having calendar table they dont generally prefer having a permanent table
Those people do not understand about database and are not DBAs :-)
It is our job to tell them what is right or wrong.
** This is a real story! I had a client several years back, who was the CEO of a software company.
He use the query:
select * from table_name
In order to get the last ID!
The table_name was actually a view that took data from several tables, and the main table that he wanted to get the ID included several string columns, with lot of data!
he actually pulled all this data to the application, just to get the lat ID in a specific table!
It is our job as Consultants or DBAs to fix's his misunderstanding :-)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
Result set does not fit; it contains too many rows
Dear All,
We are in BI7 and running reports on Excel 2007. Even though number of rows limitation in Excel 2007 is more than 1Million, when I try to execute a report with more than 65k records of output, system is generating output only for 65k rows with message "Result set does not fit; it contains too many rows".
Our Patch levels:
GUI - 7.10
Patch level is 11
Is there any way to generate more than 65000 rows in Bex?
Thanks in advance...
regards,
Raju
Dear Gurus,
Could you please shed some light on this issue?
thanks and regards,
Raju
Edited by: VaraPrasadraju Potturi on Apr 14, 2009 3:13 AMVara Prasad,
This has been discussed on the forums - for reasons of backward compatibility I do not think BEx supports more that 65000 rows .... I am still not sure about the same since I have not tried out a query with more that 65K rows on excel 2007 but I think this is not possible... -
How to know how many rows including headers and footers does subreport has from Main Report
Hi, we are sturuggling with subreports. Main report has 3 subreports, each subreport is inplmented in a group header(3 subreports and 3 group headers). We would like to print a group header under subreport as a column header every page, and need a page break when group number is changed. This report exports a MS Excel(97-2003) report file.
In main report, [New After Page] is checked under Group Header #1d from [Section Expert]
In each subreport, [Repeat Group Header On Each Page] is checked under the highest group from [Group Expert]
Here are two issues;
Since Crystal Reports has more rows than Excel in one page, colmun header in each subreport is being printed in the middle of the page. It should be printed at the top of the page
When Subreport has many rows and has to be printed in more than 1 page, a page break is automatically inserted before column header. It should be printed right below column header which is Group Header #1
We have been trying to pass row counts(count of group header because group header is used as the details) using a shared variable from Subreport 1 to Subreport 2 via main report since Subreport2 cannot predict how many rows Subreport 1 has.
Here is what we are trying but we are getting an error which is "A constant expression is required here" under main report
- In Sunreport 1
whileprintingrecords;
shared numbervar SubGroupCount := DistinctCount({Table.Field});
- In Mainreport
shared numbervar SubGroupCount;
if(pagenumber) = 1
then (SubGroupCount)
else 50
Is there any solutionss or better ways other than above?
Thank you,
Main Report: Group Header #1a --> as Page Header
Run Date: mm/dd/yyyy Report Name
Main Report Group Header #1b --> Subreport 1
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Main Report Goup Header #1c --> Subreport 2
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Main Report Froup Header #1d --> Subreport 3
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6Thank you for your reply and sorry for my complicated explanations. The report has confidential information, so I replaced to some fake data but I believe you can still see what I am trying to do..
Main Report
Subreport 2
Output1
Output2: the following page
--> more rows are printed..
We have two problems;
1. The column header in Output2 is supposed to be pronted right below the last row in Output2, however, a page break is automatically inserted. But even in the same output document, it works for some group when it has a few rows..
2. Since Crystal Reports prints more rows in one page than MS Excel does, Column header is not be printed at the top of the page.
I tried the way you advised me but it did not work.. -
Is there an easy way to see how many rows in a table? (selected or unselected)
Hi all,
Forgive me if this is a REALLY dumb question but I would love to know if there there is an easy way to to see how many rows there are in a table in InDesign?
(And I bet I am really going to kick myself when I hear the answer and how simple it probably is..lol !)
I am working on a huge catalog and am dealing with LOTS of tables...very long tables too at times. I am also doing a lot of copying and pasting back and forth between InDesign and Excel and it would REALLY help if I knew how many rows there are in a table without having to manually count them (TIRESOME!!).
Also, is there a way to see how many rows I have selected at any one time? It would be SO WONDERFUL if the info box could also provide this information.
Thank you SO MUCH in advance for your help:))
Christine
**UPDATE**
Oh boy I AM going to kick myself! Why only NOW that I wrote this question did I suddenly notice that the Table palette shows the number of rows and columns? lol.
Okay, then is there a way to see how many rows I have selected at any given time?@Christine – try the following ExtendScript (JavaScript):
if(app.selection.length === 0
|| !app.selection[0].constructor.name === "Cell"
|| !app.selection[0].constructor.name === "Table"){
exit(0);
var sel = app.selection[0];
if(sel.constructor.name === "Cell"){
var tableRowLength = sel.parent.rows.everyItem().getElements().length;
if(sel.constructor.name === "Table"){
alert("All "+sel.rows.everyItem().getElements().length+" rows selected in current table." );
exit(0);
var numberOfRowsSelected = sel.rows.length;
var indexOfSelectedRows = sel.rows.everyItem().index;
var startRowSel = indexOfSelectedRows[0]+1;
var endRowSel = indexOfSelectedRows.length+indexOfSelectedRows[0];
alert(numberOfRowsSelected +" row(s) selected.\r"+startRowSel+" to "+endRowSel+" out of "+tableRowLength+" of current table.");
You need not select whole rows, just one or a couple of cells.
Then run the script.
An alert message is telling you how many rows belong to the cell range you have selected and:
which rows of the table are selected…
A typical message would be:
6 row(s) selected.
3 to 8 out of 20 of current table.
The script does some basic checks of the selection.
If no cell or table is selected, it will just do nothing…
Uwe
Message was edited by: Laubender | Some language cosmetics in the alert message -
Copying many rows from one table to another
Could anyone tell me the best way to copy many rows (~1,000,000) from one table to another?
I have supplied a snipit of code that is currently being used in our application. I know that this is probably the slowest method to copy the data, but I am not sure what the best way is to proceed. I was thinking that using BULK COLLECT would be better, but I do not know what would happen to the ROLLBACK segment if I did this. Also, should I look at disabling the indexes while the copy is taking place, and then re-enable them after it is complete?
Sample of code currently being used:
PROCEDURE Save_Data
IS
CURSOR SCursor IS
SELECT ROWID Row_ID
FROM TMP_SALES_SUMR tmp
WHERE NOT EXISTS
(SELECT 1
FROM SALES_SUMR
WHERE sales_ord_no = tmp.sales_ord_no
AND cat_no = tmp.cat_no
AND cost_method_cd = tmp.cost_method_cd);
BEGIN
FOR SaveRec IN SCursor LOOP
INSERT INTO SALES_ORD_COST_SUMR
SELECT *
FROM TMP_SALES_ORD_COST_SUMR
WHERE ROWID = SaveRec.Row_ID;
RowCountCommit(); -- Performs a Commit for every xxxx rows
END LOOP;
COMMIT;
EXCEPTION
END Save_Data;
This type of logic is used to copy data for about 8 different tables, each containing approximately 1,000,000 rows of data.Your best bet is
Insert into SALES_ORD_COST_SUMR
select * from TMP_SALES_ORD_COST_SUMR;
commit;
Read this
http://asktom.oracle.com/pls/ask/f?p=4950:8:15324326393226650969::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:5918938803188
VG -
List of Value: Best practice when there are too many rows.
Hi,
I am working in JDev12c. Imagine the following scenario. We have an employee table and the organization_id as one of its attributes. I want to set up a LOV for this attribute. For what I understand, if the Organization table contains too many rows, this will create an extreme overhead (like 3000 rows), also, would be impossible to scroll down in a simple LOV. So, I have decided the obvious option; to use the LOV as a Combo Box with List of Values. Great so far.
That LOV will be use for each user, but it doesn't really depend of the user and the list of organization will rarely change. I have a sharedApplicationModule that I am using to retrieve lookup values from DB. Do you think would be OK to put my ORGANIZATION VO in there and create the View Accessor for my LOV in the Employees View?
What considerations should I take in term of TUNING the Organization VO?
RegardsHi Raghava,
as I said, "Preparation Failed" may be (if I recall correctly) as early as the HTTP request to even get the document for indexing. If this is not possible for TREX, then of course the indexing fails.
What I suggested was a manual reproduction. So log on to the TREX host (preferrably with the user that TREX uses to access the documents) and then simply try to open one of the docs with the "failed" status by pasting its address in the browser. If this does not work, you have a pretty good idea what's happening.
Unfortunately, if that were the case, this would the be some issue in network communications or ticketing and authorizatuions, which I can not tell you from here how to solve.
In any case, I would advise to open a support message to SAP - probably rather under the portal component than under TREX, as I do not assume that this stage of a queue error has anything to do with the actual engine.
Best,
Karsten -
ADF: Best way to find out how many rows are fetched?
Hello,
I have overridden method executeQueryForCollection of ViewObject in which I execute supper.executeQueryForCollection and after that want to find out how many rows are fetched during the execution.
If I try to use getFetchedRowCount I always get "0", if using getEstimatedRowCount, query are being re-executed.
What method is better to use for that?
Thank you,
Veniamin Goldin
Forbis, Ltd.I have a 'home-made' view called RBS, whose definition is this:
create view RBS as
select /*+ RULE */ substr(s.username,1,10) oracle,
substr(case when s.osuser like 'oramt%'
then nvl(upper(s.client_info),'client_info not set')
else substr(s.machine,instr(s.machine, '\')+1,length(s.machine))||':'||s.osuser
end
,1,20) CLIENT
, substr(''''||s.sid||','||s.serial#||''''||decode(s.status,'KILLED','*',''),1,12) kill_id
, lpad(to_char(t.xidusn),4) rbs#
, lpad(to_char(t.used_ublk),4) ublk
, lpad(to_char(t.used_urec),8) urecords
, i.block_gets
, lpad(to_number(round((sysdate - to_date(t.start_time,'MM/DD/YY HH24:MI:SS')) * 60 * 60 * 24)),9) time
, upper(substr(s.program,1,20)) PROGRAM
, to_char(s.LOGON_TIME,'HH24:MI:SS DD-MON') LOGIN_TIME
from sys.v_$transaction t
, sys.v_$session s
, sys.v_$sess_io i
, sys.v_$process p
where s.saddr = t.ses_addr
and i.sid = s.sid
and p.addr = s.paddr
/By monitoring the URECORDS column value of the row that corresponds to my session doing a transaction, I can see how it progresses.
Toon -
How to find out How many rows and coloumn exists in the Excel sheet
hai gurus,
present iam uploading data from presentation server to application server. when i use gui_upload the data is coming non-readable format.
so i used alsm_excel_to_int fm for that . but the problem is user can give any type of excel so... i need to know how many rows and coloumn s existed in that Excel
so is there any possiblity to get those values(Total rows and total coloumns).
plz help me..
if any one answered , appreciate with reward points,
thanks®ards,
Venu.Tsee you have to come into an agreement with other system before starting development..
Please dont do unnecessary coding for impractical things ..you may solve this but this is not good way of working in eRP packages..
Al least u can get final list of all Columns and which can be blank or non blank like this
then u can do coding for this scenerio
regards...
Message was edited by:
Madan Gopal Sharma -
To find out how many rows are processed/updated?
Hi Gurus,
I have given an update statement with parallelism. The data to be processed is huge around 50 million records.
I know that from OEM, we can find out how many rows it has processed or completed. I would like to know the dictionary view/ query to find out the same in SQL Plus.
Thanks
Cherrish VaidiyanI have a 'home-made' view called RBS, whose definition is this:
create view RBS as
select /*+ RULE */ substr(s.username,1,10) oracle,
substr(case when s.osuser like 'oramt%'
then nvl(upper(s.client_info),'client_info not set')
else substr(s.machine,instr(s.machine, '\')+1,length(s.machine))||':'||s.osuser
end
,1,20) CLIENT
, substr(''''||s.sid||','||s.serial#||''''||decode(s.status,'KILLED','*',''),1,12) kill_id
, lpad(to_char(t.xidusn),4) rbs#
, lpad(to_char(t.used_ublk),4) ublk
, lpad(to_char(t.used_urec),8) urecords
, i.block_gets
, lpad(to_number(round((sysdate - to_date(t.start_time,'MM/DD/YY HH24:MI:SS')) * 60 * 60 * 24)),9) time
, upper(substr(s.program,1,20)) PROGRAM
, to_char(s.LOGON_TIME,'HH24:MI:SS DD-MON') LOGIN_TIME
from sys.v_$transaction t
, sys.v_$session s
, sys.v_$sess_io i
, sys.v_$process p
where s.saddr = t.ses_addr
and i.sid = s.sid
and p.addr = s.paddr
/By monitoring the URECORDS column value of the row that corresponds to my session doing a transaction, I can see how it progresses.
Toon -
Many rows in DBA_UNDO_EXTENTS
Hi,
in my DBA_UNDO_EXTENTS I have many and many rows with status = UNEXPIRED
I'm reading these link:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/undo.htm
and Oracle® Database 2 Day DBA but i don't know how i can delete these row.
If I want introduce the Retention period i can set the RETENTION GUARANTEE to the UNDO TBS, right?
Thanks a lot, as usual
LainHello,
You can reduce the datafiles of the Undo Tablespaces as any kind of datafiles
but, you cannot go below the HWM.
Please, find enclosed a query to get the HWM position of every datafile (in Mo)
of the Undo Tablespace:
col file_name for A60
select B.file_name, (A.block_id + A.blocks)*{color:red}8{color}/1024 "Mo"
from dba_undo_extents A, dba_data_files B
where A.file_id = B.file_id
and A.block_id = (select max(C.block_id)
from dba_undo_extents C
where C.file_id = A.file_id
order by A.file_id
NB: In red the block size of your Database in Ko (here 8Ko).
You get a result like that:
FILE_NAME Mo
E:\ORACLE\ORADATA\PRD\LOG\UNDOTBS01.DBF 30.0703125
E:\ORACLE\ORADATA\PRD\LOG\UNDOTBS02.DBF 19.0703125
E:\ORACLE\ORADATA\PRD\LOG\UNDOTBS03.DBF 40.0703125So, in this example, you cannot resize the first datafile below ~ 31 Mo.
Hope this help.
Best regards,
Jean-Valentin
Edited by: Lubiez Jean-Valentin on Jan 25, 2010 8:33 PM -
Exception too many rows...
Hi
I am getting two different outputs with following code depending upon i declare the variable in first or second way...
when i declare the variable v_empno as number(10) and too many rows exception is raised....and after that i dbms this variable..it is null...
but when i declare the same variable as table.column%type....and the similar scenario happens and i dbms the value of variable...it is not null...rather the first value from output of the query...
declare
--v_empno number(10);
v_empno emp.empno%type;
begin
dbms_output.put_line('before '||v_empno );
select empno into v_empno from emp;
dbms_output.put_line('first '||v_empno);
exception when too_many_rows then
dbms_output.put_line('second '||v_empno);
dbms_output.put_line('exception'||sqlerrm);
end;
is there any specific reason for this....
ur comments plz
Thanks
SidhuIn 9i:
SQL> declare
2 --v_empno number(10);
3 v_empno emp.empno%type;
4 begin
5 dbms_output.put_line('before '||v_empno );
6 select empno into v_empno from emp;
7 dbms_output.put_line('first '||v_empno);
8 exception when too_many_rows then
9 dbms_output.put_line('second '||v_empno);
10 dbms_output.put_line('exception'||sqlerrm);
11 end;
12 /
before
second 7369
exceptionORA-01422: exact fetch returns more than requested number of rows
PL/SQL procedure successfully completed.
SQL> declare
2 v_empno number;
3 --v_empno emp.empno%type;
4 begin
5 dbms_output.put_line('before '||v_empno );
6 select empno into v_empno from emp;
7 dbms_output.put_line('first '||v_empno);
8 exception when too_many_rows then
9 dbms_output.put_line('second '||v_empno);
10 dbms_output.put_line('exception'||sqlerrm);
11 end;
12 /
before
second
exceptionORA-01422: exact fetch returns more than requested number of rows
PL/SQL procedure successfully completed.
SQL> edit
Wrote file afiedt.buf
1 declare
2 v_empno number(10);
3 --v_empno emp.empno%type;
4 begin
5 dbms_output.put_line('before '||v_empno );
6 select empno into v_empno from emp;
7 dbms_output.put_line('first '||v_empno);
8 exception when too_many_rows then
9 dbms_output.put_line('second '||v_empno);
10 dbms_output.put_line('exception'||sqlerrm);
11* end;
SQL> /
before
second 7369
exceptionORA-01422: exact fetch returns more than requested number of rows
PL/SQL procedure successfully completed.In 10G:
SQL> declare
2 v_empno number(10);
3 --v_empno emp.empno%type;
4 begin
5 dbms_output.put_line('before '||v_empno );
6 select empno into v_empno from emp;
7 dbms_output.put_line('first '||v_empno);
8 exception when too_many_rows then
9 dbms_output.put_line('second '||v_empno);
10 dbms_output.put_line('exception'||sqlerrm);
11 end;
12 /
before
second 7369
exceptionORA-01422: exact fetch returns more than requested number of rows
PL/SQL procedure successfully completed.
SQL> edit
Wrote file afiedt.buf
1 declare
2 v_empno number;
3 --v_empno emp.empno%type;
4 begin
5 dbms_output.put_line('before '||v_empno );
6 select empno into v_empno from emp;
7 dbms_output.put_line('first '||v_empno);
8 exception when too_many_rows then
9 dbms_output.put_line('second '||v_empno);
10 dbms_output.put_line('exception'||sqlerrm);
11* end;
SQL> /
before
second 7369
exceptionORA-01422: exact fetch returns more than requested number of rows
PL/SQL procedure successfully completed.
SQL> edit
Wrote file afiedt.buf
1 declare
2 --v_empno number;
3 v_empno emp.empno%type;
4 begin
5 dbms_output.put_line('before '||v_empno );
6 select empno into v_empno from emp;
7 dbms_output.put_line('first '||v_empno);
8 exception when too_many_rows then
9 dbms_output.put_line('second '||v_empno);
10 dbms_output.put_line('exception'||sqlerrm);
11* end;
SQL> /
before
second 7369
exceptionORA-01422: exact fetch returns more than requested number of rows
PL/SQL procedure successfully completed.Anyhow you should not rely on the fact Oracle fetches the first value into variable
and keeps it when the excaprion is raised.
Tom Kyte discusses the SELECT INTO issue here:
http://asktom.oracle.com/pls/ask/f?p=4950:8:7849913143702726938::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:1205168148688
Rgds.
Maybe you are looking for
-
I upgraded to 4 and I noticed that after 4 has been up for an hour or so I click on the bookmarks. I see my list of bookmarks below but when I move the cursor down to select one, the list disappears. The only way I have found to fix this is to stop a
-
Review Quiz button does not navigate to the first quiz question..
Hi, so I have created an interactive software simulation guide for users of my organisation. At the end of this guide there is a quiz (multiple choice, true or false questions) with 15 slides. At the end of the quiz the results screen is displayed wi
-
Am I correct in assuming BT no longer supplies a separate open reach modem. That is very inconvenient if true as when my one dies a natural death we are forced to use their hub instead of our own superior routers. Can the latest hubs be used in modem
-
I have a ipad 4 with 6700 hp printer. I was told by support that the way to print a page from facebook was to take a picture of the page and then print the picture. When I do this the picture is printed in the upper left hand quadrant with part of th
-
Dear experts, When it comes to PI mappings which one is resource or time intensive between RFC lookup Vs Database lookup where the table is hosted in PI itself. I really looking for this comparision in PI 7.1. If anybody looked to compare the pros