Select all similar columns
Hi All,
I would like to retrieve data from all similar columns in a table:
ex: desc table;
emp name
emp name1
emp name2
emp name3
emp name30
emp number
emp ph
so now i want retrieve all emp name* columns data with out selecting each one is there any short cut?
i have tried with rtrim but i am unable to get it. Could any body help me in this regard.
Thanks,
Red.
i guess you will need to create a dynamic query probably a reference cursor
create or replace function fnc_columns (pTable varchar2, pColumn varchar2, pReqId number)
return sys_refcursor as
c sys_refcursor;
vColumn := varchar2(2000);
begin
for col_rec in (select column_name from all_tab_columns
where column_name like 'ARGUMENT%'
and table_name = 'FND_CONCURRENT_REQUESTS'
and owner = 'FND') loop
vColumn := vColumn ||col_rec||',';
end loop;
--removes the last comma
vColumn := substr(vColumn,1,instr(vColumn,',',-1)-1);
open c for 'SELECT '||vColumn||' FROM '||pTable||
'WHERE REQUEST_ID = '||pReqId;
return c;
end;
/note: untested
or you might want to use another method such as [EXECUTE IMMEDIATE|http://www.psoug.org/reference/nds.html]
Similar Messages
-
Selecting all "similar" text - is it possible?
I have a feeling this isn't possible but i thought best go ahead and ask anyway...
I have converted a document from Quark (gasp!) to InDesign. All has gone well except the leading is a bit too close. The character styles haven't been correctly brought through from Quark so it's not simply a case of changing those, and i was thinking, you know the way in Illustrator for example you can select all items with the same colour stroke or fill and then change all accordingly, is there a way of selecting all the text with the same properties or am i going to have to go through every little text box in this 800 page document and change all the leading one by one?!
Using mac 0s x 10, InDesign CS3You should have used Paragraph Styles instead of character styles.
Use a Paragraph Style for whole paragraphs of text (even if one line) and use Character styles to give attributes to single characters/word(s) withing a paragraph.
With everything having Paragraph Styles you can have Space Above and Space Below attributes for the paragraphs.
If you want to give everything Paragraph styles, then select a paragraph and make a new paragraph style.
Search for your Body character style and replace it with your Pargraph style. -
My product has some very large tables (using RANGE_PAGING). I want to allow the end user to do a Select All operation, and then press a command button to act on all selected rows, but want my backing code to detect a Select All has been done, rather than attempt to retrieve all rows from the table. Is this doable with a RichTable?
I'm porting an existing UI over to ADF -- the old UI handled this by having a separate select all button (column header), which would get unset if any row got unselected, and the backing code could interrogate that. I was wondering if there was a more ADF-ish way of handling this.
Using Oracle JDeveloper 11g Release 1 (11.1.1.6.0)
Edited by: user12614476 on Dec 5, 2011 1:58 PM
(added JDeveloper version info)Are you really using 11.1.1.6? If so, I guess you should be asking in one of the internal Oracle forums.
But, no, there's no "more ADF-ish" way to my knowledge :)
John -
How to select all columns in a trigger?
I add a "before delete" trigger on a table, in order to insert the records to a backup table before they are deleted.
but I cannot write like this : insert into t_backup select * from :old;
The table has more than 30 columns so I don't want to select them one by one, how can I select all columns?Yes, it is possible by writing something like this :
where col1 = :old.col1; But it is not directly supported. First, we need a package to remember all the OLD records:.... and please see below link for complete code in action :
http://www.dbforums.com/oracle/925729-trigger-back-up-data.html
What I am doing here, just copying the code and replacing "emp" with "test" (The table name on which I am going to apply this using notepad find and replace):
SQL> select * from test_backup;
no rows selected
SQL> select * from test;
A
1
2
4
5
SQL> select * from test_backup;
no rows selected
SQL>
create or replace package test_trg_pkg as
type test_type is table of test%ROWTYPE index by binary_integer;
test_tab test_type;
end;
create or replace trigger test_bds before delete on test
begin
test_trg_pkg.test_tab.delete;
end;
create or replace trigger test_adr after delete on test
for each row
declare
-- To allow us to select the old values
pragma autonomous_transaction;
begin
select *
into test_trg_pkg.test_tab(test_trg_pkg.test_tab.COUNT+1)
from test
where a = :old.a; <----- Here you have to give your column name.
end;
create or replace trigger test_ads after delete on test
begin
for i in 1..test_trg_pkg.test_tab.COUNT loop
insert into test_backup values test_trg_pkg.test_tab(i);
end loop;
end;
SQL> delete from test where a=1;
1 row deleted.
SQL> select * from test_backup;
A
1
SQL> delete from test where a=2;
1 row deleted.
SQL> select * from test_backup;
A
1
2
SQL>Regards
Girish Sharma -
How to get Select All or select Multiple columns in OOALV
HI Experts
i'm assignig internal table to dynamic internal table(FS_IST_TABLE) for to display the output.
but i'm not geting the Select ALL Option. and i can't select multiple columns at a time.
where i can select only one column.
how can i select multiple columns.
please any one help me.
regrads,
rathan.Hi,
If we want to select the multiple columns in the alv by using ooabap
so in the class CL_GUI_ALV_GRID it is having one method SET_TABLE_FOR_FIRST_DISPLAY
it is having one importing parameter IS_LAYOUT of type lvc_s_layo type
and this structure contains one field SEL_MODE and set that field value as 'A'.
then we can select the multiple rows in alv grid -
HELP! Is there a way to change column information in iTunes such as name of artist, genre etc, other than deleting them one at a time? Such as the way you delete an entire group of songs by holding down control keys or selecting the Select All command. Thanks.
If you select all the songs you want to change, Be it one song or an akbum, or an Artist, Or Genre, or playlist. Then Right mouse click and Get Info. You then get a slightly different from normal Get Info box as this is the One for Multiple items.
In there have a look at the tags and see if the one you want to changes is in there. There are a few tabs so if for example you wanted to change the Media Type from Home Movie to Movie go to the Options tab and select Movie and OK and it will change the whole selection. -
What is the difference betwwen SELECT ALL Column and Select Speceific Colum
Hi All,
If the block size of the database is 8K and average row length is 2K and if we select all column of the table the I/O show that it had read more blocks then compare to
specific column of the same table. Why is this?
Secondly if Oracle brings a complete block is the db buffer cache, while reading block from disk, they why there is a difference of block count in two queries.
This difference reveals to me when I check the EXPLAIN PLAN for two different queries against the same table but one select all columns and the other one select specific column.
Kindly help me in clearing this confusion.
Regards,
Kamranuser1514587 wrote:
>
Usually, indexes are smaller (contain fewer blocks) than the table - ergo, select empno from emp could be satisfied by reading fewer blocks.
what if there is a composite Index on a table containing 3 to 4 columns and the size of table is in 100 of GB and Index size itself is vey large then I think Oracle will go for FTS and small Index scan will be expensive. Kindly Share your thoughts.
Regards,
KamranHandle: user1514587
Status Level: Newbie (5)
Registered: May 9, 2011
Total Posts: 21
Total Questions: 13 (12 unresolved)
I think you wastes everyone's time here since you rarely get answer to any posted question -
Selecting all columns from table in a model query
I have written a model query which joins 4 tables, applies some rules and returns updated rows by selecting 4 columns out of this. Currently it works fine because all 4 columns are from MODEL aliases. Now I need to select 16 more columns in the same query but none of these columns is added in MODEL aliases. When I tried selecting these columns I got oracle error ORA - 32614. Can someone please guide me to include these columns in the same model query?
I tried couple of options but no luck. Here are those options for ready reference:
1. I cannot nest existing model query into another select because there are no columns avaiable to join in output of current query to map with other records.
2. I cannot include all 16 columns in MODEL aliases because some of these columns are actually output of user defined functions.
I am using Oracle database version 11g Release 11.2.0.1.0.
Edited by: Anirudha Dhopate on Jan 23, 2011 5:43 PMThank you Avijit for your reply. There is a syntax error on the ON in this part of the statement which I don't know how to fix - I tried messing around with another INNER JOIN but am not confident that I'm doing the right thing:
SENAlertType.SENAlertTypeIDONClassMember.ClassMemberStudentID
Thanks for your help! I will need to do some more bedtime reading on joins.
Daniel -
Apply distinct to all the columns in a select list
Select distinct name, date , venue , duration from tableA
the above query distinct onlu the first column in the select list but is it possible to distinct all the columns.
current out put is
1 , raj, 25-may-2009, uk , 10
1 , raj, 25-may-2009, usa , 10
1 , raj, 25-may-2009, uk , 20
requried output....
1 , raj, 25-may-2009, uk , 10
the first found row is enogh...
thanks in advance :)
rajBut all these tree rows are distinct. Doesn't it? Why you want to take only first row? What's the logic?
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/] -
Selecting all columns makes oracle use more indexes than only selectng one?
I have 3 queries here that differ only slightly, conceptually, but the plans are massively different. What I cant work out is that the difference is only in the select list.. The fields referenced in the where clause are properly indexed for this purpose
SELECT
scc.expiry_date
FROM
bw3.int_file_log_details ifld
INNER JOIN
bw3.svc_card_status_change scsc
USING
(institution_number, file_number)
INNER JOIN bw3.svc_client_cards scc
USING
(card_number)
WHERE
institution_number = '00000001' AND
file_number = '00002504'This one above does a full table scan of SCC, over 3.5 million records
SELECT
card_number
FROM
bw3.int_file_log_details ifld
INNER JOIN
bw3.svc_card_status_change scsc
USING
(institution_number, file_number)
INNER JOIN bw3.svc_client_cards scc
USING
(card_number)
WHERE
institution_number = '00000001' AND
file_number = '00002504'This one above does an index fast full scan of SCC's pk (which is cardnumber), as does doing a "SELECT null as dummy FROM..."
SELECT
FROM
bw3.int_file_log_details ifld
INNER JOIN
bw3.svc_card_status_change scsc
USING
(institution_number, file_number)
INNER JOIN bw3.svc_client_cards scc
USING
(card_number)
WHERE
institution_number = '00000001' AND
file_number = '00002504'This one above does the index range scan of the columns mentioned in the where clause and two index unique scans to link in IFLD and SCC (because they are joined on their PKs)
I would expect all queries to run this way and completes in ~0.01 seconds
Now, I get that oracle will sometimes use only an index instead of a table access when the requested data can be got from the index, but the actual query is pulling data from some columns not in indexes, so must be accessed in the table:
SELECT
scsc.card_prod_data as "Field1",
substr(card_number,1,4)||' '||
substr(card_number,5,4)||' '||
substr(card_number,9,4)||' '||
substr(card_number,13,4)||' '||
substr(card_number,17) as "Field2",
' ' as "Field3",
scc.emboss_line_1 as "Field4",
scc.emboss_line_2 as "Field5",
TO_CHAR(TO_DATE(scc.last_issued_date, 'YYYYMMDD'), 'MM/YY ')||
TO_CHAR(TO_DATE(scc.expiry_date, 'YYYYMMDD'), 'MM/YY ')||
' ' as "Field6",
'B'||
card_number||
'^'||
RPAD('0', 27, ' ')||
'^'||
to_char(to_date(scc.expiry_date, 'YYYYMMDD'), 'YYMM')||
service_category_code||
'000000000000' as "Field7",
card_number||
'='||
to_char(to_date(scc.expiry_date, 'YYYYMMDD'), 'YYMM')||
service_category_code||
'000000000000' as "Field8",
card_number as "Field9",
scsc.cvv_cvc2 as "Field10"
FROM
bw3.int_file_log_details ifld
INNER JOIN
bw3.svc_card_status_change scsc
USING
(institution_number, file_number)
INNER JOIN bw3.svc_client_cards scc
USING
(card_number)
WHERE
institution_number = '00000001' AND
file_number = '00002504'This query above, which uses some data from all tables, does a table full scan of SCC, yet if I SELECT * FROM.. I get the expected index usage and table access by index rowid for all tables..
Why is oracle doing an FTS when I choose only some columns, yet doing index access when I select * ?
Edited by: charred on Oct 5, 2010 11:37 AMSelectivity of indexes?
For a query linking these tables:
int_file_log_details <-> svc_card_status_change <-> svc_client_cards
I'm expecting Oracle to:
Use an index range scan of the index on svc_card_status_change that is a nonunique index of institution_number and file number. Selectivity of this index is:
1 institution number in the entire table
59 distinct file numbers in the entire table
4.1million records in the entire table
From there, with the records it found, to use index unique scan of the PKs of int_file_log_details (file_number: 1 record required) and PK of svc_client_cards (card_number: poetntially thousands of records required)
I can understand if oracle might decide it can get 69k records out of 4.1 million faster by FTS the cards table rather than having the indirection of the index... what I cannot understand is:
If I select all the data from the query (SELECT *) it does unique index scans for the 2 records
If I select say, only one non-indexed non-joined column from each table, oracle prefers a FTS of the cards table..
Is oracle not realising that there are only 2 records I need out of cards? Why would select * differ? Is it that oracle thinks "select * is a large amount of data, so it'll be faster to use the index and target certain rows" vs "select one_column can be garnered more quickly by scanning the table and generating a lower overall memory load" ? -
MIRO select all column items on PO Reference tab
I have a user running 4.6C that wants to select all items in a specific column at the same time rather than having to select each one individually. I have found the documentation to change the column sequence but I can not find anything regarding how to do this. Is there a way to do this other than creating a customized user exit or ABAP code? Thanks
Please check these answered links:
Re: Hide Fields in MIRO
Miro
MIRO
Edited by: Afshad Irani on May 6, 2010 8:42 AM -
Column alias to select all fields in only one table in a join
Hi,
Please can you tell me if it is possible to use something like "SELECT a*" to select all fields in table a when using a join to join 2 tables e.g a and b? Instead of using "select acomlumn1 acomlumn2 acomlumn3" etc.
Thanks and Regards.HI,
It is not possible... You have to specify all the fields you want to select with the tilde '~' symbol...
or,
The other solution can be to fetch all the fields from the first table and use 'For all entries' of this table to fetch all fields from the other table...
Edited by: sneha singhania on Jun 23, 2009 3:01 PM -
Hi Cimmunity
as you often traval and as you say have a lot of emails: how do you delete them in masses like bulk delete? on my old blackberry (newstes except z10) I had the option to "delete all before (...) date" in the context menu and could delete 1500 emails with one tap. do you know how to do this now? there is no such function, one have to tap and mark every single email, even if there are 2000!!!!! crazy!!
thanks a lot!!
BB: please urgently add the feature again...!!!! I have a imap account with about 200 emails a day which are just copies of enterprise mail and need to delete hundreds every day. I can not tap and select all the single mails one by one and then delete.
Solved!
Go to Solution.Go into the hub, select email account, Just under the blue email account, click and hold the date bellow it , slider pops on the right, click on Trash can(delete prior).
-
Gather_table_stats with a method opt of "for all indexed columns size 0"
I have 9 databases I support that contain the same structure, and very similar data concentrations. We are seeing inconsistent performance in the different databases due to bind variable peeking.. I have tracked it down to the Min and Max values that are gathered during the analyze. I analyze from one cluster, and export/import those statistics into the other clusters.. I then go about locking down the stats gathered. Some of the statistics are on tables that contain transient data (the older data is purged, and new data gets a new PK sequence number).
Since I am gathering statistics with a 'FOR ALL INDEXED COLUMNS SIZE 1', a min and max value are grabbed. This value is only appropriate for a short period of time, and only for a specific database. I do want oracle to know the density to help calculate, but I don't want cardinality based on whether the current bind values fall in this range..
Example
COLUMN PK
When I analyze the min is 1 and max is 5. I then let the database run, and the new min is 100 and max is 105.. same number of rows, but different min/max. At first a select * from table where pk>=1 and pk <=5 would return a cardinality of 5.. Later, a seelct * from tables where pk>=100 and pk<=105 would return a cardinaility 1.
Any ideas how to avoid this other than trying set min and max to something myself (like min =1 max = 99999999). ??MarkDPowell wrote:
The Oracle documentation on bind variable peeking said it did not peek without histograms and I cannot remember ever seeing on 9.2 where the trace showed otherwise. Mark,
see this simple test case run on 9.2.0.8. No histograms, but bind variable peeking, as you can see that the EXPLAIN PLAN output generated by AUTOTRACE differs from the estimated cardinality of the actual plan used at runtime.
Which documentation do you refer to?
SQL>
SQL> alter session set nls_language = 'AMERICAN';
Session altered.
SQL>
SQL> drop table bind_peek_test;
Table dropped.
SQL>
SQL> create table bind_peek_test
2 as
3 select
4 100 as n1
5 , cast(dbms_random.string('a', 20) as varchar2(20)) as filler
6 from
7 dual
8 connect by
9 level <= 1000;
Table created.
SQL>
SQL> exec dbms_stats.gather_table_stats(null, 'bind_peek_test', method_opt=>'FOR ALL COLUMNS SIZE 1')
PL/SQL procedure successfully completed.
SQL>
SQL> variable n number
SQL>
SQL> variable n2 number
SQL>
SQL> alter system flush shared_pool;
System altered.
SQL>
SQL> exec :n := 1; :n2 := 50;
PL/SQL procedure successfully completed.
SQL>
SQL> set autotrace traceonly
SQL>
SQL> select * from bind_peek_test where n1 >= :n and n1 <= :n2;
no rows selected
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1000 Bytes=24
000)
1 0 FILTER
2 1 TABLE ACCESS (FULL) OF 'BIND_PEEK_TEST' (Cost=2 Card=100
0 Bytes=24000)
Statistics
236 recursive calls
0 db block gets
35 consistent gets
0 physical reads
0 redo size
299 bytes sent via SQL*Net to client
372 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
0 rows processed
SQL>
SQL> set autotrace off
SQL>
SQL> select
2 cardinality
3 from
4 v$sql_plan
5 where
6 cardinality is not null
7 and hash_value in (
8 select
9 hash_value
10 from
11 v$sql
12 where
13 sql_text like 'select * from bind_peek_test%'
14 );
CARDINALITY
1
SQL>
SQL> alter system flush shared_pool;
System altered.
SQL>
SQL> exec :n := 100; :n2 := 100;
PL/SQL procedure successfully completed.
SQL>
SQL> set autotrace traceonly
SQL>
SQL> select * from bind_peek_test where n1 >= :n and n1 <= :n2;
1000 rows selected.
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1000 Bytes=24
000)
1 0 FILTER
2 1 TABLE ACCESS (FULL) OF 'BIND_PEEK_TEST' (Cost=2 Card=100
0 Bytes=24000)
Statistics
236 recursive calls
0 db block gets
102 consistent gets
0 physical reads
0 redo size
34435 bytes sent via SQL*Net to client
1109 bytes received via SQL*Net from client
68 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
1000 rows processed
SQL>
SQL> set autotrace off
SQL>
SQL> select
2 cardinality
3 from
4 v$sql_plan
5 where
6 cardinality is not null
7 and hash_value = (
8 select
9 hash_value
10 from
11 v$sql
12 where
13 sql_text like 'select * from bind_peek_test%'
14 );
CARDINALITY
1000
SQL>
SQL> spool offRegards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
How to set selected all checkboxes in all dataTable's rows?
Hi there,
I'm trying to perform this simple task: having a dataTable with a column containing checkboxes, how can I allow (with a button, a "super" checkbox or so) to simultaneously set selected all checkboxes in all rows?
And - is it possible to do so without calling the submit of the page?
Thanks to everyone!Yes, the paging for <h:dataTable> works pretty good, it manages the task through four methods created in the java code -- DataTable1_firstPageAction(), DataTable1_previousPageAction(), DataTable1_nextPageAction(), DataTable1_lastPageAction() -- without adding any javascript in the jsp page.
Maybe I could test if a java script similar to the <ui:table>'s one fit also the dataTable...
thanks
Maybe you are looking for
-
Inserting pdf files in word for mac
For the life of me I can't figure out how to insert pdf files in my word for mac document. I can insert the first page of the file by inserting it as an object but can't figure out how to insert the entire document. Any suggestions would be much appr
-
How do you fix the selection wheel?
I need help with my 5th generation ipod nano. How do I get my selector wheel to work? How do I get the selector wheel to select from the menu? It says I need to connect to power source and I do and once I plug it in, the nano is compltetely charged.
-
Value of a cell dependent on a data selected from the list in another cell
Hello Everyone, Could you please help to solve this puzzle. I need to make a value of cells in the 2nd column dependent on the selection made in the cells in the 1st column, i.e.: Header 1 Header 2 List An LIst Bn Lists A and B have 10 items each A1
-
Can any one help mee how to add combobox in jtable i am using Abstracttablemodel.
-
just purchased aperture for my new macbook pro, do i now have to buy another copy for my desktop?