Check my table
I trying to create index on my table( a big one) but It take a long time, so I don't know that there are anybody update that table or not.
How can i check who using that table?
Are there any way to check?
Thanks,
Kevin
Hi,
You can try to check whether there are locks or not. Set pagesize and linesize high enough and then run:SELECT lpad(sid,3,' ')||'('||(SELECT USERNAME||'@'||MACHINE FROM V$SESSION SES WHERE SES.SID=V$LOCK.SID)||')' SESS,
DECODE(TYPE,
'TX','RBS:'||TRUNC(id1/POWER(2,16)) || '@SLOT:' || (BITAND(id1,TO_NUMBER('ffff','xxxx'))+0) ,
id1||'('||(SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE OBJECT_ID=v$lock.ID1)||')'
) OBJECT,
DECODE(lmode, 0, 'None'
, 1, 'Null'
, 2, 'Row Share'
, 3, 'Row Excl.'
, 4, 'Share'
, 5, 'S/Row Excl.'
, 6, 'Exclusive'
, lmode, ltrim(to_char(lmode,'990'))) LOCK_MODE,
DECODE(request, 0, 'None'
, 1, 'Null'
, 2, 'Row Share'
, 3, 'Row Excl.'
, 4, 'Share'
, 5, 'S/Row Excl.'
, 6, 'Exclusive'
, request, ltrim(to_char(request,'990'))) REQUEST,
decode(type,
'BL','Buffer hash table instance lock',
'CF',' Control file schema global enqueue lock',
'CI','Cross-instance function invocation instance lock',
'CS','Control file schema global enqueue lock',
'CU','Cursor bind lock',
'DF','Data file instance lock',
'DL','Direct loader parallel index create',
'DM','Mount/startup db primary/secondary instance lock',
'DR','Distributed recovery process lock',
'DX','Distributed transaction entry lock',
'FI','SGA open-file information lock',
'FS','File set lock',
'HW','Space management operations on a specific segment lock',
'IN','Instance number lock',
'IR','Instance recovery serialization global enqueue lock',
'IS','Instance state lock',
'IV','Library cache invalidation instance lock',
'JQ','Job queue lock',
'KK','Thread kick lock',
'MB','Master buffer hash table instance lock',
'MM','Mount definition gloabal enqueue lock',
'MR','Media recovery lock',
'PF','Password file lock',
'PI','Parallel operation lock',
'PR','Process startup lock',
'PS','Parallel operation lock',
'RE','USE_ROW_ENQUEUE enforcement lock',
'RT','Redo thread global enqueue lock',
'RW','Row wait enqueue lock',
'SC','System commit number instance lock',
'SH','System commit number high water mark enqueue lock',
'SM','SMON lock',
'SN','Sequence number instance lock',
'SQ','Sequence number enqueue lock',
'SS','Sort segment lock',
'ST','Space transaction enqueue lock',
'SV','Sequence number value lock',
'TA','Generic enqueue lock',
'TD','DDL enqueue lock',
'TE','Extend-segment enqueue lock',
'TM','DML enqueue lock',
'TO','Temporary Table Object Enqueue',
'TT','Temporary table enqueue lock',
'TX','Transaction enqueue lock',
'UL','User supplied lock',
'UN','User name lock',
'US','Undo segment DDL lock',
'WL','Being-written redo log instance lock',
'WS','Write-atomic-log-switch global enqueue lock',
'TS',decode(id2,0,'Temporary segment enqueue lock (ID2=0)',
'New block allocation enqueue lock (ID2=1)'),
'LA','Library cache lock instance lock (A=namespace)',
'LB','Library cache lock instance lock (B=namespace)',
'LC','Library cache lock instance lock (C=namespace)',
'LD','Library cache lock instance lock (D=namespace)',
'LE','Library cache lock instance lock (E=namespace)',
'LF','Library cache lock instance lock (F=namespace)',
'LG','Library cache lock instance lock (G=namespace)',
'LH','Library cache lock instance lock (H=namespace)',
'LI','Library cache lock instance lock (I=namespace)',
'LJ','Library cache lock instance lock (J=namespace)',
'LK','Library cache lock instance lock (K=namespace)',
'LL','Library cache lock instance lock (L=namespace)',
'LM','Library cache lock instance lock (M=namespace)',
'LN','Library cache lock instance lock (N=namespace)',
'LO','Library cache lock instance lock (O=namespace)',
'LP','Library cache lock instance lock (P=namespace)',
'LS','Log start/log switch enqueue lock',
'PA','Library cache pin instance lock (A=namespace)',
'PB','Library cache pin instance lock (B=namespace)',
'PC','Library cache pin instance lock (C=namespace)',
'PD','Library cache pin instance lock (D=namespace)',
'PE','Library cache pin instance lock (E=namespace)',
'PF','Library cache pin instance lock (F=namespace)',
'PG','Library cache pin instance lock (G=namespace)',
'PH','Library cache pin instance lock (H=namespace)',
'PI','Library cache pin instance lock (I=namespace)',
'PJ','Library cache pin instance lock (J=namespace)',
'PL','Library cache pin instance lock (K=namespace)',
'PK','Library cache pin instance lock (L=namespace)',
'PM','Library cache pin instance lock (M=namespace)',
'PN','Library cache pin instance lock (N=namespace)',
'PO','Library cache pin instance lock (O=namespace)',
'PP','Library cache pin instance lock (P=namespace)',
'PQ','Library cache pin instance lock (Q=namespace)',
'PR','Library cache pin instance lock (R=namespace)',
'PS','Library cache pin instance lock (S=namespace)',
'PT','Library cache pin instance lock (T=namespace)',
'PU','Library cache pin instance lock (U=namespace)',
'PV','Library cache pin instance lock (V=namespace)',
'PW','Library cache pin instance lock (W=namespace)',
'PX','Library cache pin instance lock (X=namespace)',
'PY','Library cache pin instance lock (Y=namespace)',
'PZ','Library cache pin instance lock (Z=namespace)',
'QA','Row cache instance lock (A=cache)',
'QB','Row cache instance lock (B=cache)',
'QC','Row cache instance lock (C=cache)',
'QD','Row cache instance lock (D=cache)',
'QE','Row cache instance lock (E=cache)',
'QF','Row cache instance lock (F=cache)',
'QG','Row cache instance lock (G=cache)',
'QH','Row cache instance lock (H=cache)',
'QI','Row cache instance lock (I=cache)',
'QJ','Row cache instance lock (J=cache)',
'QL','Row cache instance lock (K=cache)',
'QK','Row cache instance lock (L=cache)',
'QM','Row cache instance lock (M=cache)',
'QN','Row cache instance lock (N=cache)',
'QO','Row cache instance lock (O=cache)',
'QP','Row cache instance lock (P=cache)',
'QQ','Row cache instance lock (Q=cache)',
'QR','Row cache instance lock (R=cache)',
'QS','Row cache instance lock (S=cache)',
'QT','Row cache instance lock (T=cache)',
'QU','Row cache instance lock (U=cache)',
'QV','Row cache instance lock (V=cache)',
'QW','Row cache instance lock (W=cache)',
'QX','Row cache instance lock (X=cache)',
'QY','Row cache instance lock (Y=cache)',
'QZ','Row cache instance lock (Z=cache)','????') TYPE
FROM V$LOCK
ORDER BY 1,4;You can also run your index creation with the ONLINE option.
HTH,
Yoann.
Similar Messages
-
How to check 2 tables(Table A and Table B) and figure out new columns present in Table A and add these new columns to Table b.
DDL-
Create table A
( A INT,
B INT,C VARCHAR(2)
Create table B
A INT,
B INT
Any advice on the best approach or method to achieve this.
I understand that I need to check the schema of the columns and then do a match between 2 tables and find new columns and then alter my target table
MudassarCan you try this..
CREATE TABLE A ( A INT, B INT, C VARCHAR(2) )
CREATE TABLE B ( A INT, B INT )
Declare @ColumnVar nvarchar(128),@DatatypeVar nvarchar(128)
SELECT @ColumnVar=x.COLUMN_NAME, @DatatypeVar=x.DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS AS x
WHERE TABLE_NAME = 'A'
AND NOT EXISTS ( SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'B'
AND COLUMN_NAME = x.COLUMN_NAME )
Declare @SQL VarChar(1000)
SELECT @SQL = 'ALTER TABLE B ADD ' + @ColumnVar + ' '+ @DatatypeVar
Exec (@SQL)
select * from B
Please Mark This As Answer if it helps to solve the issue
http://stackoverflow.com/questions/2614101/alter-table-my-table-add-column-int -
How to check the tables we have created in JDBC??
I have created a table called COFFEE2 in a datasource called temp which is in SQL server...How to check the table values??
i went into administrative tools and odbc cource then i could see the data source i have created but how to see the table??
Can anyone help??
thanxHmm.. not sure that I understand the problem.
Call getConnection on the DataSource, and then execute the select query on the connection.
Kaj -
How to check with table for cursor..?
How to check with table for cursor..?
Here I have Table temp_final_plan
Here i want to update if already exit...below is the procedure....
CREATE OR REPLACE PROCEDURE spu_final_profit_plan
AS
-- Constant declarations
ln_errnum number := 0;
-- Variable declarations
ls_errmsg app_errors.err_msg%TYPE;
ls_appmsg app_errors.app_msg%TYPE;
ls_appid app_errors.app_id%TYPE;
-- Cursor declaration for final_update_el
CURSOR cur_final_update_el IS
select '910' ent,
'9127316' center,
post_acct,
sum(avg_mtd_01) sum_avg_mtd_01,
sum(avg_mtd_02) sum_avg_mtd_02,
sum(avg_ytd_01) sum_avg_ytd_01,
sum(avg_ytd_02) sum_avg_ytd_02
from mon_act_cypy
where rec_type = 'A'
and sum_flag = 'D'
and yr = '2008'
and substr(ctr_or_hier, 1, 2) = 'el'
and ent || sub_ent in
(select ent || sub_ent
from ent_ref
where roll_ent || roll_sub_ent = '999100')
group by post_acct
having sum(avg_mtd_01) <> 0
or sum(avg_mtd_02) <> 0
or sum(avg_ytd_01) <> 0
or sum(avg_ytd_02) <> 0;
-- Cursor declaration for final_update
CURSOR cur_final_update IS
select b.plan_ent b_plan_ent,
b.plan_ctr b_plan_ctr,
a.post_acct a_post_acct,
sum(a.avg_mtd_01) sum_avg_mtd_01,
sum(a.avg_mtd_02) sum_avg_mtd_02,
sum(a.avg_ytd_01) sum_ytd_mtd_01,
sum(a.avg_ytd_02) sum_ytd_mtd_02
from mon_act_cypy a,
plan_unit_tbl b
where a.ent || a.ctr_or_hier = b.ent || b.ctr_or_hier
and a.rec_type = 'A'
and a.sum_flag = 'D'
and a.yr = '2008'
and b.hier_tbl_num = '001'
and a.ent || a.sub_ent in
(select ent || sub_ent
from ent_ref
where roll_ent || roll_sub_ent = '999100')
group by b.plan_ent, b.plan_ctr, a.post_acct
having sum(a.avg_mtd_01) <> 0
or sum(a.avg_mtd_02) <> 0
or sum(a.avg_ytd_01) <> 0
or sum(a.avg_ytd_02) <> 0;
-- Begin the procedure body
BEGIN
-- Insert / Update final profit plan for final_update query using cursor
FOR rec_final_update_el IN cur_final_update_el
LOOP
EXIT WHEN rec_final_update_el%NOTFOUND;
IF rec_final_update_el. THEN
UPDATE temp_final_plan
SET sum_avg_mtd_01 = rec_final_update_el.sum_avg_mtd_01,
sum_avg_mtd_02 = rec_final_update_el.sum_avg_mtd_02,
sum_avg_ytd_01 = rec_final_update_el.sum_avg_ytd_01,
sum_avg_ytd_02 = rec_final_update_el.sum_avg_ytd_02,
WHERE ent = rec_final_update_el.ent
AND center = rec_final_update_el.center
AND post_acct = rec_final_update_el.post_acct;
ELSE
INSERT INTO temp_final_plan VALUES(rec_final_update_el.ent,
rec_final_update_el.center,
rec_final_update_el.post_acct,
rec_final_update_el.sum_avg_mtd_01,
rec_final_update_el.sum_avg_mtd_02,
rec_final_update_el.sum_avg_ytd_01,
rec_final_update_el.sum_avg_ytd_02);
END IF;
END LOOP;
-- Insert / Update final profit plan for final_update query using cursor
FOR rec_final_update IN cur_final_update
LOOP
EXIT WHEN rec_final_update%NOTFOUND;
IF rec_final_update. THEN
UPDATE temp_final_plan
SET sum_avg_mtd_01 = rec_final_update.sum_avg_mtd_01,
sum_avg_mtd_02 = rec_final_update.sum_avg_mtd_02,
sum_avg_ytd_01 = rec_final_update.sum_avg_ytd_01,
sum_avg_ytd_02 = rec_final_update.sum_avg_ytd_02,
WHERE ent = rec_final_update.b_plan_ent
AND center = rec_final_update.b_plan_ctr
AND post_acct = rec_final_update.a_post_acct;
ELSE
INSERT INTO temp_final_plan VALUES(rec_final_update.b_plan_ent,
rec_final_update.b_plan_ctr,
rec_final_update.a_post_acct,
rec_final_update.sum_avg_mtd_01,
rec_final_update.sum_avg_mtd_02,
rec_final_update.sum_avg_ytd_01,
rec_final_update.sum_avg_ytd_02);
END IF;
END LOOP;
-- EXCEPTION handling section
EXCEPTION
-- Fire OTHERS Exception case by default
WHEN OTHERS THEN
-- ROLL BACK Transaction, if any failure
ROLLBACK;
ln_errnum := SQLCODE;
ls_errmsg := SUBSTR(SQLERRM, 1, 100);
-- Log the ERRORS into APP_ERRORS table using SPU_LOG_ERRORS procedure
spu_log_errors(ln_errnum, ls_errmsg, ls_appid, ls_appmsg);
-- End of the stored procedure
END spu_final_profit_plan;
[\pre]I'm not sure what you mean by, 'How to check with table for cursor..?' but I'll offer a comment on your Code Snippet. I think you want to know how to check if a record exists so you know if you need to perform an INSERT or an UPDATE.
Here is a snippet of your code. I'll put my comments in "Comment" style in your code.
-- Insert / Update final profit plan for final_update query using cursor
FOR rec_final_update_el IN cur_final_update_el
LOOP
/* There is no need to test for %NOTFOUND since you are using Cursor FOR Loop!
** This construct automatically exits when the last record is processed. */
EXIT WHEN rec_final_update_el%NOTFOUND;
/* Is this where you would like to know how to Check if the record already exist??
** I asked this because, 'rec_final_update_el.' is not valid syntax. Are you looking for
** an Cursor Attribute or Method you can check here?
** I would suggest a Primary Key or Unique Index on ENT, CENTER, and POST_ACCT
** on the TEMP_FINAL_PLAN table. Then simply perform an INSERT and code an
** Exception to UPDATE when you get a DUP_VAL_ON_INDEX exception. Otherwise,
** you will need to simply run an Implicit or Explicit Cursor to test if the row exists and
** use this return value to determine if you should INSERT or UPDATE. */
IF rec_final_update_el. THEN
UPDATE temp_final_plan
SET sum_avg_mtd_01 = rec_final_update_el.sum_avg_mtd_01,
sum_avg_mtd_02 = rec_final_update_el.sum_avg_mtd_02,
sum_avg_ytd_01 = rec_final_update_el.sum_avg_ytd_01,
sum_avg_ytd_02 = rec_final_update_el.sum_avg_ytd_02,
WHERE ent = rec_final_update_el.ent
AND center = rec_final_update_el.center
AND post_acct = rec_final_update_el.post_acct;
ELSE
INSERT INTO temp_final_plan VALUES(rec_final_update_el.ent,
rec_final_update_el.center,
rec_final_update_el.post_acct,
rec_final_update_el.sum_avg_mtd_01,
rec_final_update_el.sum_avg_mtd_02,
rec_final_update_el.sum_avg_ytd_01,
rec_final_update_el.sum_avg_ytd_02);
END IF;
END LOOP;I hope I've answered your question, but if I haven't please provide more details so we can better understand your request.
Craig... -
Dear experts!
Thank you for your attention!
I have studied the SAP SD for half a year, though I still don't know how to check certain table like:
KNVS---customer master shipping data
KNBK---customer master (bank detail)
ADR---address table
ect.
could somebody help me?
Best regard!
TangdarkHi Tang,
SAP SD having lot of tables but i am telling main tables.
VBAK - Sales Document Headerdetailes
VBAP - Sales Document Itemdetailes
VBEK - Sales Document Scheduline data
LIKP - Delivery Header Detailes
LIPS - Deliver Item Detailes
VBRK - Billing Header Data.
VBRP - Billing Item Data.
VBFA - Sales Document Flow
VBUK - Sales document header status data
VBUP - Sales document item status data.......ctc.
Regards
Rajendra -
How to check PSA Table Structure ?
Hi Friends,
Can you pls any one tell me how to find out PSA Table and how to check PSA Table Structure? .Thanks in advance.
Regards,
CSHi Sri,
Goto RSA1 trans> select your DS> right clcik> Manage> you will get a Pop-up with all the PSA requests--> on the top Left you can see the PSA name(Technical name) in the form PSA/BIC/BXXXXXX
PSA & DS structue will be same. Goto RSO2 transaction> Enter your DS name> double click on the extract structure. It will take you to the Extract structure.
(Or) if you know the extract structure name, directly goto Se11 trans & enter the technical name of Extract structure & Display.
Take the screenshot & send it to your TL.
Regards,
Pavan -
Status Check on Table of Contents
My status checks work fine for all of my slides, except when I have my "Next" button jump to a slide later down the line. For some reason I'm not getting a checkmark on the TOB for that particular slide.
Also, on that particular slide, the duration will say "1:03" instead of "0.03." 0.03 is what I have allotted according to my slide timeline. So I guess it's taking into account the duration for all of the slides that I'm jumping over. Accessing the slides that I'm jumping over doesn't seem to give me a status check on the slide either.
Has anyone had this problem?
Sorry if this is confusing!I'll give that a try and see what happens.
Although, my "Next" buttons are set up that way on each slide (they pause at 1.5 seconds) and they seem to be working fine. It's only when I have the "Next" button jump over slides, for example, slide 8 jumps to slide 21 because slides 9-20 are set up as a Glossary, Examples, Resource Information, etc.
I put buttons on each slide so the student can access the Glossary, Examples, and Resource Information at any time during the training. Then on the TOB, I have these slides turned off so the student only accesses them by clicking the button on the slides.
But I'm open to trying anything so I appreciate your suggestion!
Date: Tue, 4 May 2010 09:02:35 -0600
From: [email protected]
To: [email protected]
Subject: Status Check on Table of Contents
Hi there
I don't believe the check mark will appear unless the slide plays fully. If you have a button on the slide that is pausing at perhaps 1.5 seconds and the total silde time is perhaps 3 seconds, you are essentially skipping over 1.5 seconds of the slide to visit the linked slide. You might try adjusting the pause point so it's at the end of the slide and see if that improves things. It may and it may not. I'm not certain. But it's worth a try.
Cheers... Rick
| http://www.robowizard.com/pc.gif | Helpful and Handy Links
http://www.Adobe.com/cfusion/mmform/index.cfm?name=wishform&product=5
http://www.ShowMeSolutions.biz
http://sorcererstone.wordpress.com/
http://www.gooberguides.com |
> -
How to check small table scan full table scan if we will use index in where clause.
How to check small table scan full table scan if i will use index column in where clause.
Is there example link there i can test small table scan full table if index is used in where clause.Use explain plan on your statement or set autotrace traceonly in your SQL*Plus session followed by the SQL you are testing.
For example
SQL> set autotrace traceonly
SQL> select *
2 from XXX
3 where id='fga';
no rows selected
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=13 Card=1 Bytes=16
5)
1 0 PARTITION RANGE (ALL) (Cost=13 Card=1 Bytes=165)
2 1 TABLE ACCESS (FULL) OF 'XXX' (TABLE) (Cost=13 Card
=1 Bytes=165)
Statistics
1 recursive calls
0 db block gets
1561 consistent gets
540 physical reads
0 redo size
1864 bytes sent via SQL*Net to client
333 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processed -
How to check which table is used
After creating RFQ , i want to check which table is used in creating RFQ.
how can i see that data has gone or not into the database table.Hi
See the Table EKKO and EKPO only
with EKKO-BSTYP = A
Regards
Anji -
Oracle Dictionary: check what table belongs a column from a view
hi,
Is there any way to check in the oracle data dictionary what is the table that a column in a view belongs to?
Imagine this
create view xpto as
select table_a.col1, table_a.col2, table_b.column1
from table_a, table_b
I want to know that column1 in the view xpto belongs to the table_b.
Is this possible? How?
Best Regards,
Joao OliveiraHi Mat,
I know that I can check the table columns in that view or in user_Tab_columns. The problem is that some views have columns from different tables that have the same name. Understood?
So I really need to know what tables are part of the view query.
Thanks
Joao -
How to check which table is using my table
Hi,
I have a table say Temp_Rd.
How do I check which table is using my table Temp_Rd??
Which table is using my Temp_Rd as the dependencies in the sql database?
Thank you very much.Oops, pardon me for asking the questions unclearly.
Its like some table Foreign Key is references to my this table Temp_Rd.
Eg,
CONSTRAINT "FK_SomeTable" FOREIGN KEY ("ID")
REFERENCES "Temp_Rd" ("ID")
How do I know which are the some table?
I hope I explain it better this time.
Sorrie about it. -
Howto check all tables if have unique key
I need to check all tables if they have unique key. If they do not i must print it.
How can i make this in PL/SQL
regardsBut dba_constraints is not storing the information when i establish a unique constraint by creating unique index.
SQL> create table t as select level no from dual connect by level <= 10
2 /
Table created.
SQL> create unique index t_idx on t(no)
2 /
Index created.
SQL> select distinct table_name
2 from user_indexes
3 where uniqueness = 'UNIQUE'
4 and table_name = 'T'
5 /
TABLE_NAME
T
SQL> select * from dba_constraints where constraint_type = 'U' and table_name = 'T'
2 /
no rows selected
SQL> select * from dba_constraints where table_name = 'T'
2 /
no rows selected
SQL> select * from user_constraints where table_name = 'T'
2 /
no rows selected
SQL>But on the other hand user_indexes has it in all case
SQL> drop table t
2 /
Table dropped.
SQL> create table t(no number unique)
2 /
Table created.
SQL> select distinct table_name
2 from user_indexes
3 where uniqueness = 'UNIQUE'
4 and table_name = 'T'
5 /
TABLE_NAME
T
SQL> select * from dba_constraints where table_name = 'T'
2 /
OWNER CONSTRAINT_NAME C TABLE_NAME SEARCH_CONDITION
R_OWNER R_CONSTRAINT_NAME DELETE_RU
STATUS DEFERRABLE DEFERRED VALIDATED GENERATED BAD RELY LAST_CHAN INDEX_OWNER INDEX_NAME INVALID VIEW_R
ELATED
SYSADM SYS_C00391103 U T
ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED GENERATED NAME 02-SEP-08 SYSADM SYS_C00391103Thanks,
Karthick. -
How to check one table exist or not in SAP
Hi, Gurus:
How to check one table exist or not in the SAP.
Thanks,Hi,
Query the table DD02L..
Select single * from DD02L where tabname = 'Your table name'
AND TABCLASS = 'TRANSP'. " For transparent tables.
Thanks
Naren -
How to check internal table sorted or not
Hi all
I need to check internal table sorted or not which is without header line and having only one field and six values. please let me know how to check it is sorted or not because i need to display message if it is not sorted.
thanks,
MinalHi Minal,
Go through this info.
Sorted tables
This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables using the INSERT statement. Entries are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the table key in the WHERE condition.
Stable sort
The option
SORT <itab> ... STABLE.
allows you to perform a stable sort, that is, the relative sequence of lines that are unchanged by the sort is not changed. If you do not use the STABLE option, the sort sequence is not preserved. If you sort a table several times by the same key, the sequence of the table entries will change in each sort. However, a stable sort takes longer than an unstable sort.
Examples
DATA: BEGIN OF LINE,
LAND(3) TYPE C,
NAME(10) TYPE C,
AGE TYPE I,
WEIGHT TYPE P DECIMALS 2,
END OF LINE.
DATA ITAB LIKE STANDARD TABLE OF LINE WITH NON-UNIQUE KEY LAND.
LINE-LAND = 'G'. LINE-NAME = 'Hans'.
LINE-AGE = 20. LINE-WEIGHT = '80.00'.
APPEND LINE TO ITAB.
LINE-LAND = 'USA'. LINE-NAME = 'Nancy'.
LINE-AGE = 35. LINE-WEIGHT = '45.00'.
APPEND LINE TO ITAB.
LINE-LAND = 'USA'. LINE-NAME = 'Howard'.
LINE-AGE = 40. LINE-WEIGHT = '95.00'.
APPEND LINE TO ITAB.
LINE-LAND = 'GB'. LINE-NAME = 'Jenny'.
LINE-AGE = 18. LINE-WEIGHT = '50.00'.
APPEND LINE TO ITAB.
LINE-LAND = 'F'. LINE-NAME = 'Michele'.
LINE-AGE = 30. LINE-WEIGHT = '60.00'.
APPEND LINE TO ITAB.
LINE-LAND = 'G'. LINE-NAME = 'Karl'.
LINE-AGE = 60. LINE-WEIGHT = '75.00'.
APPEND LINE TO ITAB.
PERFORM LOOP_AT_ITAB.
SORT ITAB.
PERFORM LOOP_AT_ITAB.
SORT ITAB.
PERFORM LOOP_AT_ITAB.
SORT ITAB STABLE.
PERFORM LOOP_AT_ITAB.
SORT ITAB DESCENDING BY LAND WEIGHT ASCENDING.
PERFORM LOOP_AT_ITAB.
FORM LOOP_AT_ITAB.
LOOP AT ITAB INTO LINE.
WRITE: / LINE-LAND, LINE-NAME, LINE-AGE, LINE-WEIGHT.
ENDLOOP.
SKIP.
ENDFORM.
************rewords some points if it is helpful.
Rgds,
P.Naganjana Reddy -
Best way to check if table is empty or not
Hi. I had to check if a table was empty or not, and found different solutions.
One of them called my atention, I readed it was the best way to do it (some 'dual' trick from Steven Feuerstein, they say) :
SELECT 1 FROM DUAL WHERE EXISTS (SELECT 'X' FROM TABLE);
Plan
SELECT STATEMENT ALL_ROWSCost: 4 Cardinality: 1
3 FILTER
1 FAST DUAL Cost: 2 Cardinality: 1
2 INDEX FAST FULL SCAN INDEX (UNIQUE) TABLE.UB_PK Cost: 2 Cardinality: 1
But doing some tests I found this query to have lower cost:
SELECT 1 FROM TABLE WHERE ROWNUM=1;
Plan
SELECT STATEMENT ALL_ROWSCost: 2 Cardinality: 1
2 COUNT STOPKEY
1 INDEX FAST FULL SCAN INDEX (UNIQUE) TABLE.UB_PK Cost: 2 Cardinality: 1
So, what about that dual table trick? Should I keep the 'select 1 where rownum=1' as best possible way?
I know it shouldn't matter much, but just wanna know what method works best for checking empty tables :)
Thanks.As already mentioned, you cannot just base it on cost, as the cost is not specifically a good indicator of the amount of work that will need to be done, it's just an internal figure calculated for that query and isn't really that comparible across different queries.
If you're intending to see if there is data in a table because you want to know whether to query it or not, you are actually better to just try and query the data and capture the NO_DATA_FOUND exception and handle that. In that case it requires no effort or cost up front. -
How to check the table existence in JPA
1) is there a way I can check for existence of the table using JPA, before I read the rows.
2) If I want to create two tables with same columns (name, time), Should I create two entity objects to insert? is there a way to use one enity class and specify a table to insert ?
thanks
VamshiTry this:
function findNodes(vNode){
if (vNode.className === "field"){
if (vNode.isPropertySpecified("name")===true){
var myStateName=new RegExp(vNode.name);
var returnValue = GFL.search(myStateName);
if (returnValue!=-1){
this.ui.oneOfChild.border.fill.color.value="192,192,192";
this.access="readOnly";
else{
this.ui.oneOfChild.border.fill.color.value="255,255,255";//whatever colour is open access
this.access="open";
for (var a=0;a<vNode.nodes.length;a++){
findNodes(vNode.nodes.item(a));
findNodes(xfa.form);
Kyle
Maybe you are looking for
-
Problem in using a structure with a field of data type 'RAW STRING'
Friends I have written a ZBAPI that imports a structure which has 5 fields. I have defined this in the IMPORT tab of Tr.Code <SE37>. One of the field of this structure is of data type 'RAW STRING'. When I try to activate this BAPI, I get an error me
-
I can't read a file with the ext PDF the sender informed me that the file was reset to PDF.
I can't read a file with the .ext PDF the sender informed me that the file was reset to PDF. But when I tried to open it the caption box informed me"the file is not in PDF format. I suspect the sender simply changed the file .ext which is why I can't
-
OSB Service account:Changing username runtime
Hello, I am working on OSB project. For one of the requirement we have created Service Account with Static type and linked it with Business Service. As per our requirement i need to chnage the username at runtime based on one field which is coming in
-
Hi all, I recently downgraded to itunes 10.7, but when I sign-in, it always says that" need latest version of Itunes" So, How can I do now? I love to use itunes 10.7 than itunes 11. Thanks a lot
-
Photosmart premium 320 not printing good photos wrong colors sharp but loss of detail never befo
i have a photosmart premium about 3 yrs old. always got good results when printing photos but now photos are printing with extremely saturated colors, loss of some detail but main subject is very sharp as it should be. i've used photoshop element