Using toad to search for columns in entire datamart
can anyone inform me if it is possible, using toad, to conduct a "quick search" search though an entire datamart for a specific column name and if possible how?
eg: column <pubs_visited incambridge> exists in table <things_to_do_in_cambridge> in a datamart and i want to find out if the column <pubs_visited_in_cambridge> is repeated in another table within the datamart.
<QUOTE> Not really true, all_tab_columns will give you all tables for which you've grant.</QUOTE>
tried executing the query with both (DBA_TAB_COLUMNS AND ALL_TAB_COLUMNS) and I have received different results (more results with the dba). apparently, the schema i queried in our datamart, does not contain some of the tables that have been listed using the dba function.
how could it be possible that tables which do not exist in a specified schema get listed when quering using the dba function?
Similar Messages
-
How can I use SQL to search for a pattern within a field?
Hello, Frank, Solomon, ect
I am now faced with this particular scenario, I've got the SQL to search through a field to find text within the field, but I have to know what it is before it can look for it.
What I have to do is this:
Search through a field, for a pattern, and I won't know what the data is I am looking for. Can this be done in SQL?
For instance, Here is my SQL this far, I was helped allot in order to get to this point.
select table_name,
column_name,
:search_string search_string,
result
from (select column_name,
table_name,
'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
from cols
where table_name in ('TABLE1', 'TABLE2')),
xmltable (str columns result varchar2(10) path '.')
When you execute the above SQL, you have to pass in a value. What I really need is to alter the above SQL, to make it search for a pattern that exist's within the text of the field itself.
Like for instance, lets say the pattern I am looking for is this" xx-xxxxx-xxxx" and it's somewhere in a field.
I need to alter this SQL to take this pattern and search through all the schemas and tables to look for this pattern match.
Can be done?When you use something dynamically within a function or procedure, roles do not apply and privileges must be granted directly. So, you need to grant select on dba_tab_cols directly. If you want to do pattern matching then you should use regular expressions. The following example grants the proper privileges and uses regexp_instr to find all values containing the pattern xxx-xxxx-xxxx, where /S is used for any non-space character. I limited the tables in order to save time and output for the test, but you can eliminate that where clause.
SYS@orcl> CREATE USER test IDENTIFIED BY test
2 /
User created.
SYS@orcl> ALTER USER test QUOTA UNLIMITED ON USERS
2 /
User altered.
SYS@orcl> GRANT CREATE SESSION, CREATE TABLE TO test
2 /
Grant succeeded.
SYS@orcl> GRANT SELECT ON dba_tab_cols TO test
2 /
Grant succeeded.
SYS@orcl> CONNECT test/test
Connected.
TEST@orcl> SET LINESIZE 90
TEST@orcl> CREATE TABLE table1
2 (tab1_col1 VARCHAR2(60))
3 /
Table created.
TEST@orcl> INSERT ALL
2 INTO table1 (tab1_col1) VALUES ('xxx-xxxx-xxxx')
3 INTO table1 (tab1_col1) VALUES ('matching abc-defg-hijk data')
4 INTO table1 (tab1_col1) VALUES ('other data')
5 SELECT * FROM DUAL
6 /
3 rows created.
TEST@orcl> CREATE TABLE table2
2 (tab2_col2 VARCHAR2(30))
3 /
Table created.
TEST@orcl> INSERT ALL
2 INTO table2 (tab2_col2) VALUES ('this BCD-EFGH-IJKL too')
3 INTO table2 (tab2_col2) VALUES ('something else')
4 SELECT * FROM DUAL
5 /
2 rows created.
TEST@orcl> VAR search_string VARCHAR2(24)
TEST@orcl> EXEC :search_string := '\S\S\S-\S\S\S\S-\S\S\S\S'
PL/SQL procedure successfully completed.
TEST@orcl> COLUMN "Searchword" FORMAT A24
TEST@orcl> COLUMN "Table" FORMAT A6
TEST@orcl> COLUMN "Column/Value" FORMAT A50
TEST@orcl> SELECT DISTINCT SUBSTR (:search_string, 1, 24) "Searchword",
2 SUBSTR (table_name, 1, 14) "Table",
3 SUBSTR (t.column_value.getstringval (), 1, 50) "Column/Value"
4 FROM dba_tab_cols,
5 TABLE
6 (XMLSEQUENCE
7 (DBMS_XMLGEN.GETXMLTYPE
8 ( 'SELECT ' || column_name ||
9 ' FROM ' || table_name ||
10 ' WHERE REGEXP_INSTR
11 (UPPER (' || column_name || '),''' ||
12 UPPER (:search_string) || ''') > 0'
13 ).extract ('ROWSET/ROW/*'))) t
14 WHERE table_name IN ('TABLE1', 'TABLE2')
15 ORDER BY "Table"
16 /
Searchword Table Column/Value
\S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>matching abc-defg-hijk data</TAB1_COL1>
\S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>xxx-xxxx-xxxx</TAB1_COL1>
\S\S\S-\S\S\S\S-\S\S\S\S TABLE2 <TAB2_COL2>this BCD-EFGH-IJKL too</TAB2_COL2>
3 rows selected. -
Search for column in all tables
I want to search for a column value(example instance_id=123456) in all the tables using one query rather than describing each table to find first if instance id exist and if so do a select from that table.
You could try some sort of variation of this:
DECLARE
value_of_interest NUMBER := 12345;
vTable ALL_TAB_COLS.TABLE_NAME%TYPE;
vExist ALL_TAB_COLS.COLUMN_NAME%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE(RPAD('TABLE',45,' ') || ' ' || 'EXISTS');
FOR rec in (SELECT TABLE_NAME FROM ALL_TAB_COLS WHERE COLUMN_NAME='INSTANCE_ID')
LOOP
EXECUTE IMMEDIATE 'SELECT ''' || rec.table_name || ''' AS TAB,DECODE(count(*),0,''NO'',''YES'') AS EXIST FROM '
|| rec.table_name
|| ' WHERE INSTANCE_ID=:value '
|| 'GROUP BY ''' || rec.table_name || '''' INTO vTable,vExist USING value_of_interest;
DBMS_OUTPUT.PUT_LINE(RPAD(vTable,45,' ') || ' ' || vExist);
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No Results found!');
END;Please be aware this that has not been tested, and may have to be modified for your use. -
Search for column name in DB tables
Hi Guys
Is it possible to search column name when we do not know the corresponding table in the databse
Cheers
shabarYou can use the data dictionary to search though a list of all column names. The <strike>table</strike> data dictionary view is ALL_TAB_COLUMNS.
Lets assume you want to search for ID columns:
example
select owner, table_name, column_name
from all_tab_columns
where column_name = 'ID';Edited by: Sven W. on Jun 21, 2011 1:47 PM -
How to use resource bundle entries for column names/title in .rpt file
<p>Our application needs to be able to support reporting in multiple languages. Hence we do not want to put language specifiec column names in the rpt file but rather use text for a particular locale during runtime which in java world is easily achievable using Resource Bundle entries.</p><p>Does JRC allow for using resource bundle entries as column names or for that matter for titles etc. in the .rpt file?</p>
Hi,
You can follow this step-by-step tutorial to find out how to achieve this using our User Function Libraries (UFLs). The walkthrough can be found here:
<a href="http://diamond.businessobjects.com/node/412">http://diamond.businessobjects.com/node/412</a>
Regards,<br />Sean Johnson (CR4E Product Manager) <br /><br /> <a href="http://www.eclipseplugincentral.com/Web_Links-index-req-ratelink-lid-639.html">Rate this plugin @ Eclipse Plugin Central</a> -
Messages icon not appearing on iPad 1, although able to use when I search for the application
I have an iPad 2 that has messages installed after updating to ios5. My step daughters iPad 1 has the messages built in app but it does not appear on any home screen. If we search for the application it shows up and we are able to use it.
Is there anyway he can get the app icon to appear on the home screen?If you press Ctrl and F5 at the same time, does that change? I believe Google (I'm assuming that is what you are referring to) changes search results somewhat based on if you are signed in and your preferences, etc. Try signing out of google if you are signed in.
-
How do I add my Smart Contacts (on my Mac), to my iPhone? The Smart Contacts facility makes searching for a Contact so much easier, but this facility does not seem to be available on my iPhone.
Any suggestions?How do I add my Smart Contacts (on my Mac), to my iPhone? The Smart Contacts facility makes searching for a Contact so much easier, but this facility does not seem to be available on my iPhone.
Any suggestions? -
Use variable in SQL for column name
Hi All,
We want to use a user input as a column name in APEX.
For e.g user will enter "ALLOWABLE_AMOUNT" then the query will be as follows :
select Rule,rule_name,rule_desc,"User Input" from rule_dim
where "User_input" > 100
So here the User_input will be substitued with Allowable_amount. Is this doable using any bind/substitution variables ? I tried ":P2_USER_VARIABLE" and "&P2_USER_VARIABLE." but did not work.
Please advice.Hi Andy,
You do that with an Interactive Report and a Dynamic Action.
I'll assume that you're using APEX 4.2
Here's how:
Create Page 2 with an Interactive Report
Create New Page > Report > Interactive Report > Next > Next
Enter a SQL Select statement: select Rule,rule_name,rule_desc from rule_dim
Next > Create > Edit Page
Create the item P2_USER_VARIABLE
Add Item > Number Field > Next
Item Name: P2_USER_VARIABLE
Next > Next > Next
Source Used: Always, replacing any existing value in session state
Source Type: Static Assignment (value equals source attribute)
Create Item
Create a Dynamic Action to refresh the Interactive Report when P2_USER_VARIABLE is changed
Add Dynamic Action
Name: Refresh IRR
Next >
Event: Lose Focus
Selection Type: Item(s)
Item(s): P2_USER_VARIABLE
Next >
Action: Refresh
Next >
Selection Type: Region
Region: Report 1 (10)
Create Dynamic Action
Add the ALLOWABLE_AMOUNT to the Interactive Report
Report 1
Region Source: SELECT * FROM (select Rule,rule_name,rule_desc, :P2_USER_VARIABLE AS ALLOWABLE_AMOUNT from rule_dim) WHERE ALLOWABLE_AMOUNT > 100
Apply Changes > Apply Changes
Get the Interactive Report to submit P2_USER_VARIABLE
Report 1
Page Items to Submit: P2_USER_VARIABLE
Apply Changes
Change the Heading for ALLOWABLE_AMOUNT in the Interactive Report
Interactive Report
Change the Heading of ALLOWABLE_AMOUNT to &P2_USER_VARIABLE.
Apply Changes
Run
Enter something into the USER VARIABLE field and select something else on the page. Watch the last column update to that value.
Tim. -
How to use the spotlight search for photos imported onto an apple ipod model MB528BT
I have an apple ipod model MB528BT version 4.2.1 (8C148) Im think its an iPod touch as opposed to the old iPod but cannot be certain. So first of all does this model number mean anything and/or can I confirm myself via the unit itself?
Assuming its an iPod Touch my question is :-
I have copied photos from a dvd I purchased for identifying birds onto my iMac which I readily search via spotlight.
Having downloaded these photos onto my ipod when I conduct a spotlight search it only finds the birdsong but not the image! Cannot get into settings for spotlight to set for images. If of course this is the answer.
Anyone know the answer please!
Thanks David"also i use imessage alot so when somebody sends a message who will get it the ipad or the ipod?"
Both
You can sync as many ipods/ipads/iphones as you like to one computer. -
Remove web pages from google search
As an ex-MobileMe user (I assume) your account storage has been increased for free until the end of September next year. At that time if you do nothing your account will revert to 5GB and there will be no charge. If you don't at that time wish to pay to continue to use the extended storage you should ensure that your account usage doews not exceed 5GB - if you exceed it at that time you won't be charged but you may lose some data. You won't at any point be charged without your specific agreement.
-
Whenever I search using the search bar, the Google Chrome app always uses google.com.ph as I bought and set up the iPad in the Philippines. How can I change this to google.com or google.ca permanently?
IPhoto menu ==> preferences ==> advanced
Set the print products country to US
LN -
Using JavaScript to search for dates in PDF
Hello,
I have a question about using JavaScript in Adobe Acrobat X Pro.
I want a script that automatically search dates which fall within one week of the date of today.
If this is true then the pdf file have to be deleted. If the date is later then one week of the date of today then the pdf file must be moved to a different folder.
I hope anyone can help me with a solution.
With regards,
RobertSearching is the easy part. The problem is that a script can't delete a
file, nor can it move a file to another problem.
On Wed, Jan 7, 2015 at 8:55 AM, RobertZandberg <[email protected]> -
Query Builder: Search for column
The feature to dynamically expand/shrink the table list as I type stuff in the search box is great.
But some of my tables have over 100 columns, I want to display all the tables/views having "ACCNT" in the columnname.
How can I do that?
ThanksHello,
In the Query Builder you can't but that sounds like a very good enhancment. Please idrop it in the 2.0 bug/wishlist app and we'll see if we can get it into a future version.
Carl -
Using pacman to search for packages - libraries no more used / needed
Is there a way to use pacmant to "clean out" the system, by searcing and deleting all packages and libraries no more needed nor used by anything?
Are you looking for options different from these? http://bbs.archlinux.org/viewtopic.php?id=88987
I don't think there's a completely automatic way. At least, not a way that I would trust.
Last edited by drcouzelis (2010-01-22 16:42:31) -
Which permission is needed for using the feature "Search for Workbook"?
Hi specialists,
could you please tell me which permission is needed, if the user should be able to find workbook via the search function in the "open workbook" dialog?
Thanks in advance,
MarcoHi,
user can open workbooks? Than you only have to save the workbooks in roles.
regards Sven
Maybe you are looking for
-
How do I clear multiple overrides at once?
I have hundreds of text items that are tied to a paragraph style. Somehow I accidentally changed the font on most of the objects (the style still defines the correct font). Now most text objects that use this style have an asterisk in the Paragraph S
-
How to add a border around images posted to Facebook?
I am using LR 4.1, also usis PS CS5. Anyone who uses Facebook to showcase image galleries knows that Facebook changes how images are displayed from time to time. One month it will be on a black background and the next on a white background. And the
-
There is a problem with the printer or ink system.
Will not print. Turn it off then back on; will print one document, but not the last page. Try printing only the last page, but will not print. Will not print one page documents at all. Will not print more than one document without repeating this proc
-
Material Creation date at Plant Level
Hi All, I am not able to get the date when the material was extended for a new plant . Please help me . regards, Sukant
-
OUI doesn't find JRE after WXP SP2 install
Situation: Windows XP SP2. Oracle Database Standard Edition 10.1.0.3. Plenty of free disk space. 512MiB RAM. When I start Oracle Universal Installer from the start menu, it gives an error message saying the Java RunTime Environment cannot be found so