SQL query to return list of table names.
Hi all,
I'm looking for a query that will return a list of the table names that exist in my Microsoft Access database.
Any ideas?
http://forum.java.sun.com/thread.jsp?forum=31&thread=348287
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html
I would suggest you strat to use the search at the upper right.
You can leave it blank and the advanced search will appear.
You can then select the specific areas you want to search.
Similar Messages
-
Need a query to list all table names
I have more than 500 tables in my database.
'insert_date' & 'update_date' columns are found in more than 100 tables with data type as date.
I need a query to list all table names and 'insert_date' , 'update_date' column's content.
Please Help
Lee1212
Message was edited by:
LEE1212I have more than 500 tables in my database.
'insert_date' & update_date column is found in more
than 100 tables with data type as date.
I need a query to list all table names and
'insert_date' column's content.What do you mean by "column's content". A table can have many rows. Do you want to display all the distinct value for these columns?
Below is the query to get the tables which has columns insert_Date and update_date
select table_name
from user_tab_columns
where column_name ='INSERT_DATE'
or column_name ='UPDATE_DATE'
/You can write a PL/SQL block to retrive the distinct values of INSERT_DATE for these tables
declare
TYPE ref_cur IS REF CURSOR;
insert_date_cur ref_cur;
lv_insert_date DATE;
cursor tables_list IS
select table_name
from user_tab_columns
where column_name ='INSERT_DATE';
begin
for cur_tables in tables_list
loop
OPEN insert_date_cur for 'SELECT DISTINCT insert_date from '||cur_tables.table_name;
DBMS_OUTPUT.PUT_LINE(cur_tables.table_name);
DBMS_OUTPUT.PUT_LINE('--------------------------------');
LOOP
FETCH insert_date_cur into lv_insert_date;
EXIT WHEN insert_date_cur%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(lv_insert_date);
END LOOP;
CLOSE insert_date_cur;
end loop;
end;I haven't tested this code. There might be some errors. Just posted something to start with for you. -
Parsing query and getting list of tables used
Hi All,
I require to parse sql query (simple & complex as well) and to get the list of tables used in the query.
And need to validate that, the list of tables against a whitelist to maintained in the file.
I tried to write my own parser, since there are lots possible ways to write complex queries, i am unable to cover all the scenarios.
I require a help, Is there any other ways to get the list of tables used in a query?
Thanks,
Mahendran..user10279893 wrote:
Hi All,
I require to parse sql query (simple & complex as well) and to get the list of tables used in the query.
And need to validate that, the list of tables against a whitelist to maintained in the file.
I tried to write my own parser, since there are lots possible ways to write complex queries, i am unable to cover all the scenarios.
I require a help, Is there any other ways to get the list of tables used in a query?
Thanks,
Mahendran..
You'll never cover all scenarios by trying to parse a query.
For example, what about a query that queries views and those views query pipelined functions, and those pipelined functions query other views or tables or pipelined functions etc.
And what about a query that dynamically obtains the table names, such as...
SQL> select
2 table_name,
3 to_number(
4 extractvalue(
5 xmltype(
6 dbms_xmlgen.getxml('select count(*) c from '||table_name))
7 ,'/ROWSET/ROW/C')) count
8 from user_tables
9 where iot_type != 'IOT_OVERFLOW'
10 or iot_type is null;
TABLE_NAME COUNT
DEPT 4
EMP 14
BONUS 0
SALGRADE 5
.. in this case the tables being accessed (to count their rows) are not even known within the code, they are dynamically generated queries at run-time, so the only way to know what tables are accessed is to actually run the query.
Of course, a well designed system, with proper documentation and version control would allow you to take any database object and know where and what is using it, and whether it's even being used. -
SQL query which return all the NET SERVICES which are avaiable in tnsname
hi all
how to write a sql query which return all the net services which are avaiable in tnsname.ora
Regards
sAlso, tnsnames.ora is stored on the client, and not necessarily on the server; it's possible (and quite likely) that the name I use for a database in my tnsnames.ora could be different from the name you use for the same database; conversely we might use the same name for two different databases.
Regards Nigel -
SQL- Query that return only one record
Hello,
is it possible to execute a pure SQL-Query which returns only one row although multiple rows are found.
It is no problem in PL/SQL, but I have no idea if the same is also possible in SQL.
thanks in advance
MichaelWhy not? There are 4 records in this table, but only selected one.
SQL> with t
2 as
3 (
4 select '#%$@#$@$@##$' Addr from dual
5 union all
6 select '18 Jalan Scott' from dual
7 union all
8 select '18 Lemana St' from dual
9 union all
10 select '32-penstation' from dual
11 union all
12 select '99999999999' from dual
13 )
14 select addr
15 from t
16 where rownum =1
17 /
ADDR
#%$@#$@$@##$
SQL>Cheers
Sarma. -
Is there a list of table name and object name? (oCompany.GetBusinessObject)
Hi,
How do I find the objects regarding the tables in SBO?
Example Item Master, I use following statement:
SAPbobsCOM.Items oItem;
oItem = ( SAPbobsCOM.Items ) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);
I like to find the object for SPP1.
Is there a list of table name and object name?
Thank you,
RuneThank you, Owen,
Yes, I found the table name and method name in SDK Help Center:
On your P/C, click START. Select All programs , SAP Business One > SDK > SDK Help Center. Then select DI API, then DI API Reference. If you scroll down this window you will find all existing classes. You will then find the SpecialPrices and the SpecialPricesDataAreas. All the information required to code is in there. -
Query to return list of all missing primary key ids from table T1
I found this query online that returns a start and stop for a range of all missing primary key id values from table T1. However i want to rewrite this query to return a whole list of all the missing primary key ids and not a start and stop range. any help plz?
select strt, stp
from (select m.id + 1 as strt,
(select min(id) - 1 from T1 x where x.id > m.id) as stp
from T1 m left outer join T1 r on m.id = r.id - 1 where r.id is null)x where stp is not nullwith t as
select 1 as id from dual union all
select 2 as id from dual union all
select 3 as id from dual union all
select 5 as id from dual union all
select 8 as id from dual union all
select 10 as id from dual union all
select 11 as id from dual union all
select 20 as id from dual
select id_start + level missing_id
from (
select id id_start,
nullif(lead(id) over(order by id) - 1, id) id_end
from t
start with id_end is not null
connect by prior id_start = id_start
and prior dbms_random.random is not null
and level <= id_end - id_start
MISSING_ID
4
6
7
9
12
13
14
15
16
17
18
MISSING_ID
19
12 rows selected.Or:
with t as
select 1 as id from dual union all
select 2 as id from dual union all
select 3 as id from dual union all
select 5 as id from dual union all
select 8 as id from dual union all
select 10 as id from dual union all
select 11 as id from dual union all
select 20 as id from dual
select id_start + level - 1 missing_id
from (
select min(id) id_start,
max(id) id_end
from t
connect by level <= id_end - id_start
minus
select id
from t
MISSING_ID
4
6
7
9
12
13
14
15
16
17
18
MISSING_ID
19
12 rows selected.SY. -
SQL Developer - Cannot see list of tables in my connection
Hi - when I downloaded and started to use the SQL developer tool, once I connected, I could see all of the tables/columns in my connection on the left side of the tool, and I had my query panel, results panel, and SQL history stacked on the right. Suddenly something has changed, and I cannot see the list of tables, etc. in my connection anymore, so I have to rely on memory and SQL history to remember the table and column names. It has to be "hidden" somehow, but view-connections does not help, and trying to click and drag windows doesn't uncover it either.
Any suggestions?
Thanks!Probably better to ask in the SQL Developer forum here: SQL Developer
I've been trying the version 2 beta though and it has quite a few bugs in. Table browsing is working fine for me, but all my functions and procedures have disappeared from the tree view. It does odd things with code formatting too.
I don't think it will be supplanting trusty old command line SQL Plus for me yet any time soon... -
SQL Query to return all the dependent objects
Hi,
I have a question.
Suppose I am creating a table with a join on 10 other tables, views etc..
And there are nested sub-queries in the CREATE statement.
How can I get the list of all the dependent objects for that table without counting them manually.
I know, we can right click the table/view name and check the dependent objects in Toad or SQL Developer.
But, I want to know the SQL query for getting that information.
Thanks
Rajivwell there is no way oracle would know what query was used when the table was created.
But here is one intuitive trick:
Step 1: Create a procedure that will have a cursor declared on the query you want to know what tables/views are used.
Step 2: Check USER_DEPENDENCIES to see what objects this procedure depends on
Let say you want to create TEST_A table using the following statement:
create table test_a
as
select *
from scott.emp,
scott.dept;
1 create or replace procedure test_temp
2 as
3 cursor test_cur is
4 select *
5 from scott.emp,
6 scott.dept;
7 begin
8 null;
9* end;
SQL> /
Procedure created.
SQL> show errors
No errors.
SQL> desc user_dependencies
Name Null? Type
NAME NOT NULL VARCHAR2(30)
TYPE VARCHAR2(17)
REFERENCED_OWNER VARCHAR2(30)
REFERENCED_NAME VARCHAR2(64)
REFERENCED_TYPE VARCHAR2(17)
REFERENCED_LINK_NAME VARCHAR2(128)
SCHEMAID NUMBER
DEPENDENCY_TYPE VARCHAR2(4)
SQL> select referenced_owner, referenced_name, referenced_type
2 from user_dependencies
3 where name='TEST_TEMP' and referenced_owner<>'SYS';
REFERENCED_OWNER
REFERENCED_NAME
REFERENCED_TYPE
SCOTT
DEPT
TABLE
SCOTT
EMP
TABLE
SQL>
SQL> drop procedure test_temp;
Procedure dropped.
SQL>Message was edited by:
tekicora
Message was edited by:
tekicora -
Hello everybody,
I want to build a select list with all my LOV tables, that I've created for my project.
In the SQL Developer, I can use the following SQL statement:
SELECT table_name FROM tables WHERE table_name LIKE '%LOV%';
Now I get all tables, that contain "LOV" in their name. But that won't work within Apex. I want to get these table names in a select list. How to do this? Do I have to change sth in the query and where do I have to put it?
Greetings
HolgerHi,
Have you tried something like:
SELECT TABLE_NAME
FROM ALL_TABLES
WHERE OWNER = '#OWNER#'
AND UPPER(TABLE_NAME) LIKE '%LOV%'
ORDER BY 1Andy -
Discoverer Report - SQL Query to retrieve list of parameters
Hi
We have around 100 Discoverer reports and I'm trying to find the list of parameters used in each report.
Is there any SQL query that I can use to find the parameters used for each report
or
should I open the reports one by one to fetch the list of parameters used.
I checked the tables in EUL4_US schema but no luck.
- Amarnath.Kgive this a try for starters. It looks at the custom folders defined in the business area, which is where any LOV's defined for you parameters would be. As far as looking at the workbooks themselves, no, there is no way to do that in sql.
select
decode(eb.ba_created_by,'ORACLE_APPS','Seeded','Custom') Origin,
eb.ba_name business_area,
eo.OBJ_TYPE,
decode(eo.obj_type, 'SOBJ','From Database', 'CUO', 'Custom Query', 'COBJ', 'Complex Folder', eo.obj_type) obj_type_desc,
eo.OBJ_NAME folder,
eo.OBJ_DESCRIPTION folder_description,
decode(eo.sobj_ext_table, NULL, NULL, eo.obj_ext_owner || '.' || eo.sobj_ext_table) base_object,
decode(es.seg_obj_id, null, UPPER(trim(eo.obj_object_sql1)||trim(eo.obj_object_sql2)||trim(eo.obj_object_sql3))
, UPPER(trim(es.seg_chunk1) || trim(es.seg_chunk2) || trim(es.seg_chunk3) || trim(es.seg_chunk4))) SQL
from
eul4_us.EUL5_BAS eb,
eul4_us.EUL5_objs eo,
eul4_us.EUL5_BA_OBJ_LINKS ebol,
eul4_us.eul5_segments es
where
eb.BA_ID = ebol.BOL_BA_ID and
ebol.BOL_OBJ_ID = eo.OBJ_ID and
eo.obj_id = es.seg_obj_id (+) and
decode(eb.ba_created_by,'ORACLE_APPS','Seeded','Custom') = 'Custom'
order by
/*decode(eb.ba_created_by,'ORACLE_APPS','Seeded','Custom'), */eb.ba_name, ebol.BOL_SEQUENCE, es.seg_sequence -
How to check the sql:query is return null value
I have use :
<sql:query var="sql1" dataSource="${db}">
select col_name from table_name
where a=<c:out value="${row.test1}"/>
and b='<c:out value="${row.test2}"/>'
</sql:query>
So, how can I check this statement return null value which is no record within this table?The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
<sql:query var="books"
sql="select * from PUBLIC.books where id = ?" >
<sql:param value="${bookId}" />
</sql:query>
<c:if test="${books.rowCount > 0}">
</c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
Look for query Tag Result Interface -
SQL Statement error - ORA-00903: invalid table name
Hi
I have written a sql script that gets executed from a form within e-business suite. Unfortunately, the script is falling over with an error:
unknown command beginning "MERGE INTO..." - rest of line ignored.
unknown command beginning "USING edop..." - rest of line ignored.
unknown command beginning "ON (elw.ro..." - rest of line ignored.
unknown command beginning "WHEN MATCH..." - rest of line ignored.
For a list of known commands enter HELP
and to leave enter EXIT.
SET ELW.billed_flag = t.billed_flag,
ERROR at line 2:
ORA-00903: invalid table name the actual statement that is causing the issue is:
MERGE INTO edopaif.table1 elw
USING edopaif.tablw2 t
ON (elw.rowid = t.LOAD_WORKING_ROWID)
WHEN MATCHED THEN
UPDATE
SET ELW.billed_flag = t.billed_flag,
ELW.last_bill_generated = t.last_bill_generated,
ELW.last_bill_type = t.last_bill_type,
ELW.load_month = t.load_month,
ELW.BILL_TRANSACTION_ID = t.bill_transaction_id
WHEN NOT MATCHED THEN
INSERT(error_meaning)
VALUES('ROWID error with ins_ptia');The version of e-business suite that we are using is: 11.5.10.2.
The version of the Oracle database that we are using is:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
Please note that I am able to successfully run the statement directly connected as the APPS schema in the database - the error only occurs when the script is run from the forms front-end (which is really confusing me).
Many thanks
PaulHi
I've modified the script to include only the statement that is erroring and it still errors when executed from the front end application.
Next I re-wrote the statement to use PL/SQL instead of the MERGE statement, to do the update, and the script completes succesfully, i.e.:
DECLARE
CURSOR cu_lw IS
SELECT t.billed_flag,
t.last_bill_generated,
t.last_bill_type,
t.load_month,
t.bill_transaction_id,
t.load_working_rowid
FROM table2 t;
BEGIN
FOR rec_cu_lw IN cu_lw LOOP
UPDATE table1 elw
SET ELW.billed_flag = rec_cu_lw.billed_flag,
ELW.last_bill_generated = rec_cu_lw.last_bill_generated,
ELW.last_bill_type = rec_cu_lw.last_bill_type,
ELW.load_month = rec_cu_lw.load_month,
ELW.BILL_TRANSACTION_ID = rec_cu_lw.bill_transaction_id
WHERE elw.rowid = rec_cu_lw.load_working_rowid;
END LOOP;
END;
/I am still unsure as to why the MERGE statement is failing when executed in the front end, but completes in the backend with no issues at all. Obviously I would prefer to use the MERGE statement instead of PL/SQL to do the update.
Thanks
Paul -
SQL Query to return multiple transactions in a 5 min. period
I have been asked to write a query that scans a table of financial transactions looking for more than 1 transaction by the same person (EmplID for example) within a 5 minute period. I am not sure if this is possible with SQL. Here are the details:
Table = MEALTRANSLEDGER
Relevant Columns:
"TRANDATE" DATE,
"EMPLID" NUMBER(9,0)
I need to select these columns when a particular EmplID has logged more than 1 transaction in a 5 minute period.
I know I could do this with PL/SQL or Perl by stepping through the rows of the table and calculating date differences, but I would really like to know if SQL could do it.
Thanks for the help.
Version Info:
SQL> select * from v$version where banner like 'Oracle%';
BANNER
Oracle Database 10g Release 10.2.0.4.0 - ProductionYou can use something along these lines to determine the minutes difference between transactions...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as emplid, to_date('01/01/2010 09:00:00', 'DD/MM/YYYY HH24:MI:SS') as trandate from dual union all
2 select 1, to_date('01/01/2010 09:10:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
3 select 1, to_date('01/01/2010 09:20:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
4 select 1, to_date('01/01/2010 09:45:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
5 select 1, to_date('01/01/2010 09:51:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
6 select 2, to_date('01/01/2010 09:12:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
7 select 2, to_date('01/01/2010 09:18:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
8 select 2, to_date('01/01/2010 09:22:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
9 select 2, to_date('01/01/2010 09:30:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
10 select 3, to_date('01/01/2010 09:05:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
11 select 3, to_date('01/01/2010 10:10:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
12 select 3, to_date('01/01/2010 11:15:00', 'DD/MM/YYYY HH24:MI:SS') from dual
13 )
14 --
15 select emplid, trandate
16 ,(trandate-lag(trandate) over (partition by emplid order by trandate)) * (24*60) as mins_diff
17 from t
18* order by emplid, trandate
SQL> /
EMPLID TRANDATE MINS_DIFF
1 01/01/2010 09:00:00
1 01/01/2010 09:10:00 10
1 01/01/2010 09:20:00 10
1 01/01/2010 09:45:00 25
1 01/01/2010 09:51:00 6
2 01/01/2010 09:12:00
2 01/01/2010 09:18:00 6
2 01/01/2010 09:22:00 4
2 01/01/2010 09:30:00 8
3 01/01/2010 09:05:00
3 01/01/2010 10:10:00 65
3 01/01/2010 11:15:00 65
12 rows selected.And then you can wrap that up to just highlight the problem ones...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as emplid, to_date('01/01/2010 09:00:00', 'DD/MM/YYYY HH24:MI:SS') as trandate from dual union all
2 select 1, to_date('01/01/2010 09:10:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
3 select 1, to_date('01/01/2010 09:20:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
4 select 1, to_date('01/01/2010 09:45:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
5 select 1, to_date('01/01/2010 09:51:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
6 select 2, to_date('01/01/2010 09:12:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
7 select 2, to_date('01/01/2010 09:18:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
8 select 2, to_date('01/01/2010 09:22:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
9 select 2, to_date('01/01/2010 09:30:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
10 select 3, to_date('01/01/2010 09:05:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
11 select 3, to_date('01/01/2010 10:10:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
12 select 3, to_date('01/01/2010 11:15:00', 'DD/MM/YYYY HH24:MI:SS') from dual
13 )
14 --
15 select emplid, trandate
16 from (
17 select emplid, trandate
18 ,(trandate-lag(trandate) over (partition by emplid order by trandate)) * (24*60) as mins_diff
19 from t
20 )
21 where mins_diff <= 5
22* order by emplid, trandate
SQL> /
EMPLID TRANDATE
2 01/01/2010 09:22:00
SQL> -
Query to find out the table name and column name..
Hi Experts,
I have an Oracle DB in which has more than 50 tables and 100,000 records. I want to get the record which contains *"ITxtVarValue references a non existing text"* the text.
Is there any query there to find out the table name and column name of this particular record where it reside?
Please help. Any help will be rewarded.
Thanks,
GUsing this forum's search function, I found a thread that should give you an idea: How to find out a tablename
C.
Maybe you are looking for
-
Built-in iSight camera doesn't work all the time...?
This started on iChat... When starting a video conference I see a black picture, the green light turns on but my buddy only see's a video of herself and is still able to hear me. I tried opening the audio/video preferences and the preview is still bl
-
How to include mxml in a panel
hi, I have a set of mx:Panels The content to be displayed inside each panel is structured in an mxml file. How do i reference or place this mxml file inside the panels. Thanks, Lucky
-
"iTunes cannot run bcuz required files are missing"
Please help...I've reinstalled itunes like the messaged suggested however, I lost everything.
-
Installation of IDES ECC 5.0
Hello ! Maybe it is a stupid question but we have to check all possibilities before we install our new IDES system. We have a R/3 Enterprise system only for test purpose (licensed). Now we want to install a new IDES-system. Due to lack of capacity we
-
I lost my filter plug ins when I installed Elements 13, i.e. Topaz Labs, Nik. If choose one plugin in preferences it will add it to the filter list. But if I try to add another filter it just replaces the first one. How can I get my multiple plugi