Query to find the no of columns in a table
Is there a query to find the total number of columns in a table?
Dou you know read?
-- the number of rows in a table named yourtable:
select count(1) from yourtable;
-- the number of columns in a table
-- If is a user's table:
select count(1)
from user_tab_columns
where table_name='YOURTABLE'
--If it is´t
select count(1)
from DBA_tab_columns
where owner = 'USEROWNER'
and table_name='YOURTABLE'
Similar Messages
-
Query to find the second maximum date in a table
please give me the query to find the second maximum date in a table
You can try with this
SELECT empno
,hiredate
FROM emp a
WHERE 2 = (SELECT COUNT(DISTINCT hiredate)
FROM emp b
WHERE b.hiredate >= a.hiredate
OR
SELECT empno
,hiredate
FROM (SELECT ROWNUM row_num
,empno
,hiredate
FROM emp a
ORDER BY hiredate ASC
WHERE row_num = 2;Regards
Arun -
How to find the frequently updated columns in a table
Hi ,
I need to find out all the columns of a tables which are frequently getting updated.
is there any way that I can achieve this ? I am not sure if any meta data information for DML operations exist in Oracle 9 i. Any input is welcome.
Thanks in Advance !!Thank u , i am thinking the same, Thanks for the suggestion.
any other idea.... like is there any system table which we can query to get details about these dml operations on a table ?are there any kind of system audit tables in oracle where these get recorded ? -
Join query to get the constraint type ,column type and table name
Hi ,This is my query
select
table_name , column_name from user_cons_columns where table_name='EMP_CLASS'
table_name column_name
emp_class empno
emp_class deptno
select constraint_type,table_name from user_constraints where table_name='EMP_CLASS'
constraint_type table_name
p emp_class
u emp_class
I need query for this out put combining above two query.
constraint_type column_name table_name
p empno emp_class
u deptno emp_classThanks,
Deekay.Hi,
Try this:
select a.table_name , a.column_name ,b.constraint_type from user_cons_columns a, user_constraints b
where a.table_name=b.table_name and a.table_name='EMP_CLASS'How about reading the JOIN documentation??
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/queries006.htm#SQLRF30046
Cheers,
Avinash -
Find the sequence name for a particular table
Hi,
Please give query to find the sequence name for a particular table in oracle.
ThanksI mean getting List of Sequence names defined in DB.
I got the answers
select *from user_sequences -
SQL Query to find the Notify upon Completion employees
Hi,
I am looking for a query to find the names of the employees/users who are notified upon the completion of the Concurrent Programs. I know how to find the concurrent program details but not able to find notify upon completion employees details. Please help me.
Thanks,
KMThanks Scott for responding. There is no any custom code. Here is the navigation to reach there:
System Administrator -> Requests -> View -> Specific Requests -> Open any request ->View Details -> Options -> Notify the following people
I am looking for the query to find these notified people using SQL Query.Query FND_CONCURRENT_REQUESTS table (NOTIFY_ON_PP_ERROR column) -- http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=FND_CONCURRENT_REQUESTS&c_owner=APPLSYS&c_type=TABLE
Thanks,
Hussein -
Query to find the no. of related no. of Items with a item.
Hi,
I made some items in inventory. I have to find the no. of child items that are connected to a parent item. Like if there is a parent item a and it has two sub item b1 and b2. again b1 has two subitem b11, b12. similar b2 have two subitem b21, b22. and this goes on. So i have to make a query to find out all the the items.
Plz give me the solutions.
Regards
user609981Dou you know read?
-- the number of rows in a table named yourtable:
select count(1) from yourtable;
-- the number of columns in a table
-- If is a user's table:
select count(1)
from user_tab_columns
where table_name='YOURTABLE'
--If it is´t
select count(1)
from DBA_tab_columns
where owner = 'USEROWNER'
and table_name='YOURTABLE' -
Query to find the Views and synonyms that are accessing through db_link
HI all,
Oracle 10g
I need a Query to find the Views and synonyms that are accessing through db_link.
ie.
database A have the db_link to database B through a schema A
now i need to find what are the Synonyms and views that are accessing through db_link either directly or indirectly..
regards,
Deepak
Edited by: Deepak_DBA on Dec 10, 2010 5:38 PMOn the second database (B) use this query to find the SQL which used by the schema A (DB LINK USER). Check the SQL_FULLTEXT column.
select sql_fulltext,sql_id,module,parsing_schema_name,parsing_user_id,first_load_time,loads,users_executing,rows_processed,plsql_exec_time,sorts,fetches,invalidations,parse_calls,cpu_time,elapsed_time,disk_reads,buffer_gets
from V$sqlarea
where parsing_schema_name = 'A' --and to_char(first_load_time,'dd/mm/yyyy') like '%11/08/2007'
order by first_load_time desc;
Regards
Asif Kabir -
How to find the number of columns in an internal table DYNAMICALLY ?
Hi,
How to find the number of columns in an internal table DYNAMICALLY ?
Thanks and Regards,
saleem.Hi,
you can find the number of columns and their order using
the <b>'REUSE_ALV_FIELDCATALOG_MERGE'</b>
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = sy-repid
changing
ct_fieldcat = IT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif
now describe your fieldcat . and find no of columns.
and their order also..
regards
vijay -
Query to find the list of users having access to a particular scenario
Hi,
I am learning Hyperion Planning 9.2 x version. I wanted to know the query to find the list of users having access to Plan Iteration - 1 scenarion.
As I am new to Hyperion Essbase and Hyperion Planning, I am assuming these ideas work out to get the desired result.
1) As Hyperion Planning uses Relational DB to store the User Security information, we can query the list of users who is having access to Plan Iteration - 1 Scenario.
I am not sure if this solution works. Please correct me If I am wrong.
2) We can also query from the essbase editor to find out who all having access to this scenario.
If the above is correct, can you please provide me the query.
I am really need of this and I will be happy if any one provide the solution.
Thanks & Regards,
Upendra. BesthaHi,
If you are looking for some SQL to retrieve the access rights by member then you can use something like (SQL Server code though can easily be modified for Oracle)
SELECT usr.object_name as Username,mem.object_name as Member,
'Access Rights' = CASE acc.access_mode
WHEN -1 THEN 'None'
WHEN 1 THEN 'Read'
WHEN 2 THEN 'Write'
WHEN 3 THEN 'Write'
ELSE 'Unknown' END,
'Relation' = CASE acc.flags
WHEN 0 THEN 'Member'
WHEN 5 THEN 'Children'
WHEN 6 THEN 'Children (inclusive)'
WHEN 8 THEN 'Descendants'
WHEN 9 THEN 'Descendants (inclusive)'
ELSE 'Unknown' END
FROM
hsp_access_control acc, hsp_object mem, hsp_object usr
WHERE acc.object_id = mem.object_id
AND acc.user_id = usr.object_id
AND mem.object_name = 'Plan Iteration - 1'
Cheers
John
http://john-goodwin.blogspot.com/ -
Query to find the memory of database in oracle,sql
Hi All,
Please let me know the query to find the memory of database in oracle,sql.
Thanks,
sajithHow do I find the overall database size?
The biggest portion of a database's size comes from the datafiles. To find out how many megabytes are allocated to ALL datafiles:
select sum(bytes)/1024/1024 "Meg" from dba_data_files;
To get the size of all TEMP files:
select nvl(sum(bytes),0)/1024/1024 "Meg" from dba_temp_files;
To get the size of the on-line redo-logs:
select sum(bytes)/1024/1024 "Meg" from sys.v_$log;
Putting it all together into a single query:
select a.data_size+b.temp_size+c.redo_size "total_size"
from ( select sum(bytes) data_size
from dba_data_files ) a,
( select nvl(sum(bytes),0) temp_size
from dba_temp_files ) b,
( select sum(bytes) redo_size
from sys.v_$log ) c;
Another query ("Free space" reports data files free space):
col "Database Size" format a20
col "Free space" format a20
select round(sum(used.bytes) / 1024 / 1024 ) || ' MB' "Database Size"
, round(free.p / 1024 / 1024) || ' MB' "Free space"
from (select bytes from v$datafile
union all
select bytes from v$tempfile
union all
select bytes from v$log) used
, (select sum(bytes) as p from dba_free_space) free
group by free.p
This is what I use :P From http://www.orafaq.com/wiki/Oracle_database_FAQ#How_do_I_find_the_overall_database_size.3F -
Query to find the latest record with respect to the current status
Dear gurus
I have the following data in a table
Customernum
bkcode
reqtdate
Prevstat
currstat
The data will be like this
CustomerNum bkcode reqdate prevstat currstat
5900 1 03-Aug-12 0 1
5900 1 06-Aug-12 1 0
5900 5 22-Jun-12 0 1
If a customer has an issue to solved, a record is added with bkcode , register date and currstat will be 1
If the issue is resolved for the bookingcode,a new record is added, the currentstatus will become 0. and prev stat will show 1. Row no 1 and 2 reflects this case
If this table is queried for finding the unresolved issues. the output should be only the Last row of the above example. since issue with bookingcode 1 has been resolved
I have trying hard to get this thing confused what to use Lead or Max
Kindly guide meHi,
one way here:
WITH mytable(CustomerNum, bkcode, reqdate, prevstat, currstat)
AS
SELECT 5900, 1, TO_DATE('03-Aug-12', 'DD-Mon-YY'), 0, 1 FROM DUAL UNION ALL
SELECT 5900, 1, TO_DATE('06-Aug-12', 'DD-Mon-YY'), 1, 0 FROM DUAL UNION ALL
SELECT 5900, 5, TO_DATE('22-Jun-12', 'DD-Mon-YY'), 0, 1 FROM DUAL
SELECT CustomerNum, bkcode, reqdate, prevstat, currstat
FROM (SELECT a.*
, ROW_NUMBER() OVER (PARTITION BY CustomerNum, bkcode
ORDER BY reqdate DESC) AS rn
FROM mytable a
WHERE rn=1
AND currstat=1;
CUSTOMERNUM BKCODE REQDATE PREVSTAT CURRSTAT
5900 5 22-JUN-12 0 1Regards.
Al
Edited by: Alberto Faenza on Dec 18, 2012 5:23 PM
Changed again!! Previous logic was wrong -
Query to find the Salary table details HRMS 11i
I am looking query to find the persons salary details in Oralce EBS 11i.
I tried the below query bu it didn'ty work.
SELECT papf.employee_number
,papf.full_name
,pj.NAME job
,haou.NAME ORGANIZATION
,ppp.proposed_salary_n salary
FROM per_all_people_f papf
,per_all_assignments_f paaf
,per_jobs pj
,hr_all_organization_units haou
,per_position_definitions ppd
,per_all_positions pap
,per_pay_proposals ppp
WHERE 1 = 1
AND SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.current_employee_flag = 'Y'
AND papf.employee_number IS NOT NULL
AND paaf.person_id = papf.person_id
AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND paaf.job_id = pj.job_id
AND paaf.organization_id = haou.organization_id
AND paaf.position_id = pap.position_id
AND pap.position_definition_id = ppd.position_definition_id
AND ppp.pay_proposal_id = (SELECT MAX (pay_proposal_id)
FROM per_pay_proposals
WHERE assignment_id = paaf.assignment_id)
In our case all the below tables have 0 records..
select count(*) from PER_PAY_PROPOSALS ;
COUNT(*)
0
select count(*) from pay_element_entry_values_f;
COUNT(*)
0
select count(*) from PAY_ELEMENT_ENTRY_VALUES_F;
COUNT(*)
0
select count(*) from PAY_ELEMENT_ENTRIES_F;
COUNT(*)
0Hi,
Your results clearly states that there is no salary data which is been captured as well as there are no element entries which are assigned to any assignment.
Please do the below which will insert records in salary as well as element entries table:
1. Add a salary proposal to any active employee (People Enter and Maination --> Search for any employee --> Assignment --> Salary) - This will insert a record in PER_PAY_PROPOSALS table
2. Add an element entry to any active assignment (People Enter and Maination --> Search for any employee --> Assignment --> Entries) - This will insert a record in PAY_ELEMENT_ENTRIES_F and PAY_ELEMENT_ENTRY_VALUES_F table
Hope this clarifies.
Thanks,
Sanjay -
Sql query to find the space in between the sentense
hi,
can anybody tell me the query to find the space in between the data
chandanNot sure what you mean, but you might want to take a look at INSTR, like in
instr (txt, ' ') -
Sql query to find the balances for a customer account wise.
Hi,
Could someone help me with the sql query to find the balances for each customer account wise. This is need to generate the report.
presently we are using this query, but the output doesnot return the expected result.
SELECT sum(nvl(ps.acctd_amount_due_remaining,0)) "Balance"
FROM ra_cust_trx_line_gl_dist_all gld,
gl_code_combinations c,
ar_payment_schedules_all ps,
RA_CUSTOMER_TRX_ALL rat,
ra_customers rc
WHERE c.CHART_OF_ACCOUNTS_ID = 101
and gld.code_combination_id = c.code_combination_id
and rat.CUSTOMER_TRX_ID=gld.CUSTOMER_TRX_ID
and rat.CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
and ps.customer_id=rc.customer_id
and ps.status='OP'
and ps.gl_date <= :PDATE
and ps.org_id=:PORGID
and ps.class in ('GUAR','INV','DM','DEP')
and c.SEGMENT4=:Account_id
and ps.customer_id=:Customer_id
Thanks in advance.
Kalyan.Can someone help us with this.
Maybe you are looking for
-
Listener & grid control after upgrade to 11.1.0.7
going from 10.2.0.2 to 11.1.0.7 on aix 5.3 On our test server we have about 8 databases that are all currently using the 10.2 listener. I've upgraded one of our very basic test databases to 11g this morning, and for the time being just created a new
-
I am running xp service pack 3 i have trie adobe reader xi i am now running reader x i have rel;oaded driver restarted comp-uter and reloaded reader please help have also tried to use it unprotected and that didnt work
-
Implement B2B Trading Partner scenario using DUNS Number
Hi, I have a requirement where in we have to send XML to different external Partners. The external Partners are identified based on the DUNS number. Also these external Partners would be sending us the data and depending upon the Partner we have t
-
I really like using CSS to layout a page or add to an existing page. I want to line up three equal size columns using CSS instead of having a table. See this page for an example of the first column. I tried to position the second column #test3 in css
-
Hi, In the Standard "IC_AGENT" role, "Account Identification" work centre, I want to replace Installed Base view with Fact Sheet view. Please Advice, Thanks in Advance, Ponits will be rewarded!!