Give me the sql query which calculte the table size in oracle 10g ecc 6.0
Hi expert,
Please give me the sql query which calculte the table size in oracle 10g ecc 6.0.
Regards
Orkun Gedik wrote:
select segment_name, sum(bytes)/(1024*1024) from dba_segments where segment_name = '<TABLE_NAME>' group by segment_name;
Hi,
This delivers possibly wrong data in MCOD installations.
Depending on Oracle Version and Patchlevel dba_segments does not always have the correct data,
at any time esp. for indexes right after being rebuild parallel (Even in DB02 because it is using USER_SEGMENTS).
Takes a day to get the data back in line (never found out, who did the correction at night, could be RSCOLL00 ?).
Use above statement with "OWNER = " in WHERE for MCOD or connect as schema owner and use USER_SEGMENTS.
Use with
segment_name LIKE '<TABLE_NAME>%'
if you like to see the related indexes as well.
For partitioned objects, a join from dba_tables / dba_indexes to dba_tab_partitions/dba_ind_partitions to dba_segments
might be needed, esp. for hash partitioned tables, depending on how they have been created ( partition names SYS_xxxx).
Volker
Similar Messages
-
Can anybody provide the SQL query to find the files uploaded in a particular folder?
Hi All,
Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
Any help is greatly appreciated.
With best regards,
NevinNevin,
Be great if we could know the version of Portal. For Rel. 1, here's the query
select id,masterthingid from wwv_things
where siteid = &site
and cornerid = &corner
&site - Content Area id
&corner - Folder id
if you don't know the folder id, use
select id from wwv_corners where siteid = &site
and name = &folder
Hope this helps. I have run into this situation before. Usually, the culprits were
one of the following:
1. Junk Characters in description of item (caused due to Copy-Paste)
2. Special Characters in the File name
Hi All,
Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
Any help is greatly appreciated.
With best regards,
Nevin -
How to prove the SQL query will spawning the process
In a Oracle 10g database, i noticed a user running a sql query which contain lot of "group by" "order by" iin database, suspected it spawning multiple process in database then causing the ORA-00020: maximum number of processes exceeded.
My question is, is there any dictionary view or report that i can generate to prove that is the problematic sql causing the error?
Please help. Many thanks.John Stegeman wrote:
What makes you think that group by and order by spawn processes? In general, they don't. In fact, I cannot think of any reason they would (and if I'm wrong, I'm sure I'll be corrected forthwith)No, no correction.
A query is a query bound to a session.
I can only imagine that a query can spawn lots op parallel slaves when using parallel server. -
What is the sql query to know the database name having known table name?
when i am running the following query....error coming
select * from information_schema.tables where table_name = 'articles'
Error starting at line 1 in command:
select * from information_schema.tables where table_name = 'articles'
Error at Command Line:1 Column:33
Error report:
SQL Error: ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
*Cause:
*Action:
i am running the above query in SQLDeveloper tool against ORACLE database
plz give alternate solution.Hi,
select * from information_schema.tables where table_name = 'articles'You are trying query view ( information_schema.tables ) from MSSQL on ORACLE??!!
Each RDBMS have your own data dictionary... you must check documention of ORACLE to query the properly data dictionary.
Try it:
select * from users_tables where table_name = 'articles'
or
select * from all_tables where table_name = 'articles'
or
select * from dba_tables where table_name = 'articles'http://docs.oracle.com/cd/E11882_01/server.112/e25494/general011.htm#ADMIN11564
Regards,
Levi Pereira -
Where and how do I get the SQL Query used by the Microsoft Generic Report Library - Alerts?
Background:
I'm tasked with the following: I need to create a new Report and the SQL
The two canned reports that I can pattern after are: Microsoft Generic Report Library
- Alerts (there is also an alert detail report that can be chosen within the alert report that we may want to use instead)
- Most Common Alerts
I'm trying to do this:
Add another parameter to search on customfield3.
It should be able to report on all alerts that were assigned to the specific team for the time period along with the top 10 (most common alerts) assigned to the team for the time period.
Choose as the objects (group) all servers, but Imay need to adjust the report to just look at all alerts without having to provide objects or a group
The struggle I'm having is: I know SQL. I know how to create an RDL file.
But Where are the RDL files for the canned reports so I can modify the canned RDL and modify its SQL and forms?
What is the SQL/ where can I find the SQL used for the Generic Report Library -> AlertsEasy but you need to extract it from Microsoft Generic Report Pack.
So.. the procedure is as follows:
1) You export and unseal Management Pack from your SCOM using
Boris's OpsgMgr tools (MPViewer
2.3.3)
2) Ok you've got unsealed xml, now the tricky part, use
MpElementsExtract tool, example of usage:
MPElementsExtract.exe <MP.xml> /ex /destination:<destination>
That you way you get several folders out of mp:
DWScripts, DWSubScripts, LinkedReports, ReportResources, Reports
Take a look into content of first 2, there will be pure sql scripts, and rdl's are in Reports folder :)
Other way is to just use SQL profiler and catch SQL query while generating report.
--- Jeff (Netwrix) -
SQL query performance difference with Index Hint in Oracle 10g
Hi,
I was having a problem in SQL select query which was taking around 20 seconds to get the results. So, by hit and trail method I added Index Oracle Hint into the same query with the list of indexes of the tables and the results are retrieved with in 10 milli seconds. I am not sure to get How this is working with Indexes Hint.
The query with out Index Hint:
select /*+rule*/ FdnTab2.fdn, paramTab3.attr_name from fdnmappingtable FdnTab, fdnmappingtable FdnTab2, parametertable paramTab1 ,parametertable paramTab3 where FdnTab.id=52787 and paramTab1.id= FdnTab.id and paramTab3.id = FdnTab.id and paramTab3.attr_value = FdnTab2.fdn and paramTab1.attr_name='harqUsersMax' and paramTab1.attr_value <> 'DEFAULT' and exists ( select ParamTab2.attr_name from parametertable ParamTab2, templaterelationtable TemplateTab2 where TemplateTab2.id=FdnTab.id and ParamTab2.id=TemplateTab2.template_id and ParamTab2.id=FdnTab2.id and ParamTab2.attr_name=paramTab1.attr_name) ==> EXECUTION TIME: 20 secs
The same query with Index Hint:
select /*+INDEX(fdnmappingtable[PRIMARY_KY_FDNMAPPINGTABLE],parametertable[PRIMARY_KY_PARAMETERTABLE])*/ FdnTab2.fdn, paramTab3.attr_name from fdnmappingtable FdnTab, fdnmappingtable FdnTab2, parametertable paramTab1 ,parametertable paramTab3 where FdnTab.id=52787 and paramTab1.id= FdnTab.id and paramTab3.id = FdnTab.id and paramTab3.attr_value = FdnTab2.fdn and paramTab1.attr_name='harqUsersMax' and paramTab1.attr_value <> 'DEFAULT' and exists ( select ParamTab2.attr_name from parametertable ParamTab2, templaterelationtable TemplateTab2 where TemplateTab2.id=FdnTab.id and ParamTab2.id=TemplateTab2.template_id and ParamTab2.id=FdnTab2.id and ParamTab2.attr_name=paramTab1.attr_name) ==> EXECUTION TIME: 10 milli secs
Can any one suggest what could be the real problem?
Regards,
PurushothamSorry,
The right query and the explain plan:
select /*+rule*/ FdnTab2.fdn, paramTab3.attr_name from fdnmappingtable FdnTab, fdnmappingtable FdnTab2, parametertable paramTab1 ,parametertable paramTab3 where FdnTab.id=52787 and paramTab1.id= FdnTab.id and paramTab3.id = FdnTab.id and paramTab3.attr_value = FdnTab2.fdn and paramTab1.attr_name='harqUsersMax' and paramTab1.attr_value <> 'DEFAULT' and exists ( select ParamTab2.attr_name from parametertable ParamTab2, templaterelationtable TemplateTab2 where TemplateTab2.id=FdnTab.id and ParamTab2.id=TemplateTab2.template_id and ParamTab2.id=FdnTab2.id and ParamTab2.attr_name=paramTab1.attr_name)
SQL> @$ORACLE_HOME/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
Plan hash value: 651267974
| Id | Operation | Name |
| 0 | SELECT STATEMENT | |
|* 1 | FILTER | |
| 2 | NESTED LOOPS | |
| 3 | NESTED LOOPS | |
| 4 | NESTED LOOPS | |
|* 5 | INDEX UNIQUE SCAN | PRIMARY_KY_FDNMAPPINGTABLE |
PLAN_TABLE_OUTPUT
|* 6 | TABLE ACCESS BY INDEX ROWID| PARAMETERTABLE |
|* 7 | INDEX UNIQUE SCAN | PRIMARY_KY_PARAMETERTABLE |
| 8 | TABLE ACCESS BY INDEX ROWID | PARAMETERTABLE |
|* 9 | INDEX RANGE SCAN | PRIMARY_KY_PARAMETERTABLE |
| 10 | TABLE ACCESS BY INDEX ROWID | FDNMAPPINGTABLE |
|* 11 | INDEX UNIQUE SCAN | SYS_C005695 |
| 12 | NESTED LOOPS | |
|* 13 | INDEX UNIQUE SCAN | PRIMARY_KY_PARAMETERTABLE |
|* 14 | INDEX UNIQUE SCAN | PRIMARY_KEY_TRTABLE |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
1 - filter( EXISTS (SELECT 0 FROM "TEMPLATERELATIONTABLE"
"TEMPLATETAB2","PARAMETERTABLE" "PARAMTAB2" WHERE
"PARAMTAB2"."ATTR_NAME"=:B1 AND "PARAMTAB2"."ID"=:B2 AND
"PARAMTAB2"."ID"="TEMPLATETAB2"."TEMPLATE_ID" AND
"TEMPLATETAB2"."ID"=:B3))
5 - access("FDNTAB"."ID"=52787)
6 - filter("PARAMTAB1"."ATTR_VALUE"<>'DEFAULT')
7 - access("PARAMTAB1"."ID"="FDNTAB"."ID" AND
PLAN_TABLE_OUTPUT
"PARAMTAB1"."ATTR_NAME"='harqUsersMax')
9 - access("PARAMTAB3"."ID"="FDNTAB"."ID")
11 - access("PARAMTAB3"."ATTR_VALUE"="FDNTAB2"."FDN")
13 - access("PARAMTAB2"."ID"=:B1 AND "PARAMTAB2"."ATTR_NAME"=:B2)
14 - access("TEMPLATETAB2"."ID"=:B1 AND
"PARAMTAB2"."ID"="TEMPLATETAB2"."TEMPLATE_ID")
Note
- rule based optimizer used (consider using cbo)
43 rows selected.
WITH INDEX HINT:
select /*+INDEX(fdnmappingtable[PRIMARY_KY_FDNMAPPINGTABLE],parametertable[PRIMARY_KY_PARAMETERTABLE])*/ FdnTab2.fdn, paramTab3.attr_name from fdnmappingtable FdnTab, fdnmappingtable FdnTab2, parametertable paramTab1 ,parametertable paramTab3 where FdnTab.id=52787 and paramTab1.id= FdnTab.id and paramTab3.id = FdnTab.id and paramTab3.attr_value = FdnTab2.fdn and paramTab1.attr_name='harqUsersMax' and paramTab1.attr_value <> 'DEFAULT' and exists ( select ParamTab2.attr_name from parametertable ParamTab2, templaterelationtable TemplateTab2 where TemplateTab2.id=FdnTab.id and ParamTab2.id=TemplateTab2.template_id and ParamTab2.id=FdnTab2.id and ParamTab2.attr_name=paramTab1.attr_name);
SQL> @$ORACLE_HOME/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
Plan hash value: 2924316070
| Id | Operation | Name | Rows | B
ytes | Cost (%CPU)| Time |
PLAN_TABLE_OUTPUT
| 0 | SELECT STATEMENT | | 1 |
916 | 6 (0)| 00:00:01 |
|* 1 | FILTER | | |
| | |
| 2 | NESTED LOOPS | | 1 |
916 | 4 (0)| 00:00:01 |
| 3 | NESTED LOOPS | | 1 |
401 | 3 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 4 | NESTED LOOPS | | 1 |
207 | 2 (0)| 00:00:01 |
|* 5 | TABLE ACCESS BY INDEX ROWID| PARAMETERTABLE | 1 |
194 | 1 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | PRIMARY_KY_PARAMETERTABLE | 1 |
| 1 (0)| 00:00:01 |
|* 7 | INDEX UNIQUE SCAN | PRIMARY_KY_FDNMAPPINGTABLE | 1 |
PLAN_TABLE_OUTPUT
13 | 1 (0)| 00:00:01 |
| 8 | TABLE ACCESS BY INDEX ROWID | PARAMETERTABLE | 1 |
194 | 1 (0)| 00:00:01 |
|* 9 | INDEX RANGE SCAN | PRIMARY_KY_PARAMETERTABLE | 1 |
| 1 (0)| 00:00:01 |
| 10 | TABLE ACCESS BY INDEX ROWID | FDNMAPPINGTABLE | 1 |
515 | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 11 | INDEX UNIQUE SCAN | SYS_C005695 | 1 |
| 1 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 1 |
91 | 2 (0)| 00:00:01 |
|* 13 | INDEX UNIQUE SCAN | PRIMARY_KEY_TRTABLE | 1 |
26 | 1 (0)| 00:00:01 |
|* 14 | INDEX UNIQUE SCAN | PRIMARY_KY_PARAMETERTABLE | 1 |
65 | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
1 - filter( EXISTS (SELECT /*+ */ 0 FROM "TEMPLATERELATIONTABLE" "TEMPLATETAB
2","PARAMETERTABLE"
PLAN_TABLE_OUTPUT
"PARAMTAB2" WHERE "PARAMTAB2"."ATTR_NAME"=:B1 AND "PARAMTAB2"."ID"
=:B2 AND
"TEMPLATETAB2"."TEMPLATE_ID"=:B3 AND "TEMPLATETAB2"."ID"=:B4))
5 - filter("PARAMTAB1"."ATTR_VALUE"<>'DEFAULT')
6 - access("PARAMTAB1"."ID"=52787 AND "PARAMTAB1"."ATTR_NAME"='harqUsersMax')
7 - access("FDNTAB"."ID"=52787)
9 - access("PARAMTAB3"."ID"=52787)
11 - access("PARAMTAB3"."ATTR_VALUE"="FDNTAB2"."FDN")
13 - access("TEMPLATETAB2"."ID"=:B1 AND "TEMPLATETAB2"."TEMPLATE_ID"=:B2)
14 - access("PARAMTAB2"."ID"=:B1 AND "PARAMTAB2"."ATTR_NAME"=:B2)
PLAN_TABLE_OUTPUT
Note
- dynamic sampling used for this statement
39 rows selected. -
How to view the sql query?
hi,
how to view the sql query formed from the xml structure in the receiver jdbc?You can view SAP Note at
http://service.sap.com/notes
But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
Reason and Prerequisites
You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
When you want to use a parameter documented here, please be aware to which category it belongs!
Solution
The following list shows all available parameters of category 1 or 2. Please note:
Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
The default value of a parameter is always chosen that it does not change the standard functionality
JDBC Receiver Adapter Parameters
1. Parameter name: "logSQLStatement"
Parameter type: boolean
Parameter value: true for any string value, false only for empty string
Parameter value default: false (empty String)
Available with: SP9
Category: 2
Description:
When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
This should be used only during the test phase and not in productive scenarios.
Regards,
Prateek -
SQL Query to get the # of files in folders in a library
Anyone has the SQL query to list the number of files in each folders in a SharePoint library?
Technically it's a grey area of support as MS don't mind you doing it but won't help you if you encounter problems, the script is much better though.
Scratch that, the script isn't that good. It's using .items which won't work on large lists and is slow. The version below is untested but should be significantly faster and work on large lists.
$starttime = Get-Date
#Creating new site object
$siteurl = Read-Host "Enter the name of your site and press enter"
$site = New-Object Microsoft.SharePoint.SPSite($siteurl)
#Assigning all webs (sites) to $webs
$webs = $site.Allwebs
#System Libraries defined so they won't be touched##
$systemlibs =@("Converted Forms", "Customized Reports", "Documents", "Form Templates",
"Images", "List Template Gallery", "Master Page Gallery", "Pages",
"Reporting Templates", "Site Assets", "Site Collection Documents",
"Site Collection Images", "Site Pages", "Solution Gallery",
"Style Library", "Theme Gallery", "Web Part Gallery", "wfpub")
Write-Host "Total number of webs that will be traversed: " $webs.count
$DocLibsCount = 0
$DocLibwItems = 0
$totalitems = 0
$subfolderitems = 0
foreach($web in $webs)
$listcoll = $web.lists
foreach($list in $listcoll)
if($list -eq $null)
Write-Host
else
$base = $list.GetType()
if($base.name -eq "SPDocumentLibrary")
if ($systemlibs -contains $list)
{ continue}
else
$DocLibsCount += 1
$totalitems += $List.itemcount
$name = $list.Title
$folders = $web.GetFolder($name).SubFolders
for($etr = 0;$etr -lt $folders.count; $etr++)
if($folders[$etr].Name -ne "Forms")
Write-Host "Processing SubFolder ItemCount" -ForegroundColor Red
$tempcount = $folders[$etr].ItemCount
$subfolderitems += $tempcount
Write-Host
Write-Host
Write-Host "Total # of Document Libraries: " $DocLibsCount -ForegroundColor Green
Write-Host "Total # of Document Libraries that contain items: " $DocLibwItems -ForegroundColor Green
Write-Host "Total # of items: " $totalitems -ForegroundColor Green
Write-Host "Total # of items in DocLib\Subfolders: " $subfolderitems -ForegroundColor Green
$finishtime = Get-Date
Write-Host
Write-Host “Script Duration” –ForegroundColor Yellow
Write-Host “Started: “ $starttime –ForegroundColor Yellow
Write-Host “Finished: “ $finishtime –ForegroundColor Yellow
Stop-SPAssignment -Global -
SQL query to get the list of approvals
Hi,
Could someone let me know the SQL query to get the list of all the pending approvals for a user in OIM 11g R2.
ThanksThere are a few ways to do this:
- The easiest would be to use a Relationship Query from the CMC. To do this, go to the Universes section on the CMC, right click on the relevant universe, select tools >> Check Relationships.
- Use Query Builder. You will need more than one query to pull the information you need. You could try something like the below (for Webi)
SELECT SI_NAME, SI_WEBI, SI_DATACONNECTION FROM CI_APPOBJECTS
WHERE SI_KIND = 'universe' and SI_NAME = 'Universe Name'
This will give you a list of Webi Reports by SI_ID.
You'll need another query to list Webi report names:
SELECT SI_NAME FROM CI_INFOOBJECTS WHERE SI_ID IN (SI_ID from query above)
- This is trivial via Auditing / the Activity universe. This of course will only return reports that have already run.
Best.
Srinivas -
GRC - SQL Query to retrive the Approver/Rejecter Names
Hello,
I was trying to write a sql query to retrive the name of the user who has approved or rejected a particular Approval Notification in GRC Flow rule.
This query should retrive the user , who has taken the action. This user name will be added to the Role, which inturn will be attached to the Approval Group
Thanks,
GowriBasically, We have GRC Flow rule, with a process flow written to send Notification
Here we have added a Approver Group with approval type as Wait for Approval and Vote Percentage as 100
Two users are added to the Role which inturn is added to the Approval Group. What is the SQL query to retrieve the Username who has Approval or Rejection for a notification?
Can anyone please help
Thanks,
Gowri -
How to view the sql query generated in query designer..?
Hi experts,
Can i view the sql query generated by the query designer for a query in sap bw?
regards,
ksvsivamHi Sivam,
You can definitely view the sql query.
Go to RSRT and give the report name. Then goto Execute+Debug and click on it.
A new window will open, there tick the box Display SQL/BIA Query and the press on the ok button.
Finally click on execute. The Sql query will be displayed.
Hope this helps.
Thanks,
Rahul -
How to get cm:search to use the max attribute when creating the SQL query?
When we use the max attribute in the cm:search tag, it does not seem to honor the max attribute when creating the SQL query. However, the result returned from the tag is limited to the number specified by the max attribute. Then the tag seems to work as intended, but the performance will be sub optimal when the SQL query returns unnecessary rows to the application.
We use the cm:search tag to list the latest news (ordered by date), and with the current implementation we have to expect a decrease in performance over time as more news is published. But we can’t live with that. We need to do the constraint in the SQL query, not in the application.
The sortBy attribute of cm:search is translated to “order by” in the SQL query, as expected.
Is it possible to get cm:search to generate the SQL query with an addition of “where rownum <= maxRows”?Hi Erik,
The behavior of a repository in regards to the search tag's max results parameter is dependent on the underlying repository's implementation. That said, the OOTB repository in WLP does augment the generated SQL to limit the number of rows returned from the database. This is done in the parsing logic. This behavior may differ with other repository implementations.
-Ryan -
Sql query to achive the running division
Hi all, plz help me out with the sql query to achive the below output
create table emp_a (empno number, deptno number, sal number)
insert into emp_a values(901, 10,100);
insert into emp_a values(902, 10,400);
insert into emp_a values(901, 20,300);
insert into emp_a values(902, 20,2100);
i want the ouput in below format
empno deptno sal div_sal
901 10 100 (300/100)
901 20 300 (300/100)
902 10 400 (2100/400)
902 20 2100 (2100/400)
the div_sal column should have the output of greatest sal/second smallest sal for each empnoHi,
781649 wrote:
Hi all, plz help me out with the sql query to achive the below output
create table emp_a (empno number, deptno number, sal number)
insert into emp_a values(901, 10,100);
insert into emp_a values(902, 10,400);
insert into emp_a values(901, 20,300);
insert into emp_a values(902, 20,2100);
i want the ouput in below format
empno deptno sal div_sal
901 10 100 (300/100)
901 20 300 (300/100)
902 10 400 (2100/400)
902 20 2100 (2100/400)
the div_sal column should have the output of greatest sal/second smallest sal for each empnofor empno=901, then second smallest sal is 300. For empno=902, the second smallest sal is 2100.
Instead of "second *smallest* ", do you mean "second *greatest* "?
What if there's a tie (e.g.
INSERT INTO emp_a (empno, deptno, sal) VALUES (903, 10, 300);
INSERT INTO emp_a (empno, deptno, sal) VALUES (903, 20, 300);
INSERT INTO emp_a (empno, deptno, sal) VALUES (903, 30, 200);) Would you count 200 or 300 as the second greatest?
Here's one way:
WITH got_r_num AS
SELECT empno, deptno, sal
, ROW_NUMBER () OVER ( PARTITION BY empno
ORDER BY sal DESC
) AS r_num
FROM emp_a
SELECT e.empno
, e.deptno
, e.sal
, '(' || TO_CHAR (r1.sal)
|| '/'
|| TO_CHAR (r2.sal)
|| ')' AS div_sal
FROM emp_a e
JOIN got_r_num r1 ON e.empno = r1.empno
JOIN got_r_num r2 ON e.empno = r2.empno
WHERE r1.r_num = 1
AND r2.r_num = 2
; -
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.
-
How to find out which Tables have been accessed without looking at the SQL query ?
Hi,
I would like to know is there a way to find out what queries have been executed and on which tables without looking at the SQL query.
I have an old C++ code which calls some library functions to access the Oracle database. The source code for the library is not available to me yet. The functions selects/updates/deletes and inserts based on some input parameters I give. I do not know which tables it affects. How do I find out the actual SQL query and/or the tables it accesses ? I was told about V$SQL table that
has the most recently executed queries, but
I did'nt see any queries connected to my process.
Could anybody help me on this ?
Thanks
Jagdeep
[email protected]
nullPRECISE/SQL can help you if you have access to it
2nd option can be that turn on SQL_TRACE
Run executable of ur c++ program
it will create a trace file in user_dump_dest
and then using TKPROF u can see all quesries and their plan also.
HTH
Gagan Deep Singh
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by (jagdeeps):
Hi,
I would like to know is there a way to find out what queries have been executed and on which tables without looking at the SQL query.
I have an old C++ code which calls some library functions to access the Oracle database. The source code for the library is not available to me yet. The functions selects/updates/deletes and inserts based on some input parameters I give. I do not know which tables it affects. How do I find out the actual SQL query and/or the tables it accesses ? I was told about V$SQL table that
has the most recently executed queries, but
I did'nt see any queries connected to my process.
Could anybody help me on this ?
Thanks
Jagdeep
[email protected]<HR></BLOCKQUOTE>
null
Maybe you are looking for
-
How to delete other people's music from my itunes account
I had a lodger for around 6 months who used my PC to play music. Whilst doing so, he created his own account and downloaded music in to my Library. Every so often I will come across a song that wants his iTunes login. I would like to delete all musi
-
HT1692 How can i retrieve a deleted calendar on iPad?
I have deleted a calander from my iPad. I want to restore it. My last sync with iTunes was a long time ago...
-
How do i transfer my data from my old ipad to my new mac
how do i
-
Sql queries in database adapter
Hi, I want to write, say, 2 select statements in the database adapter. How can I accomadate using "execute pure sql"? Regards, Aasta
-
Variable Bind Data in Oracle 9i
Hi everyone, I am trying to write a query in Oracle 9i which can resolve bound data names and values, but can't seem to find a way to do so. I have a 10g query which works great, but uses v$sql_bind_capture to find the variable names. 10g query: SELE