the help of SQL queries
my existing query isSelect c.ADVICE_NOTE_ID, C.TAX_AUTH_ID
of OUTBOUND_EXTERNAL_SETTLE_TBL b, outbound_payment_tbl c
where B.OUTBOUND_PYMNT_ID = C.OUTBOUND_PYMNT_ID
now I need to select from the advice_note_id of sample_tbl where the combination of sample_tbl.advice_note and sample_tbl. TAX_AUTH_ID does not match the one selected by top of the query.
Hello
This looks like a job for NOT IN:
SELECT advice_note_id
FROM sample_tbl
WHERE (advice_note, tax_auth_id) NOT IN
(
select c.ADVICE_NOTE_ID
, C.TAX_AUTH_ID
from OUTBOUND_EXTERNAL_SETTLE_TBL b
, outbound_payment_tbl c
where B.OUTBOUND_PYMNT_ID = C.OUTBOUND_PYMNT_ID
)
;
This requires that thatadvice_note_id and tax_auth_id cannot be NULL in outbound_payment_tbl.
Tags: Database
Similar Questions
-
How to use the value of the select in SQL queries list
I have a list with the list of states (P1_STATE) in Page 1. When I send the page, I get the VALUE of P1_STATE in Page 2 to the format: DC:AS:AK. I use the application to display the form in the Page 2 below.
Select *.
of STATE_REF
where IN location_id (: P1_STATE)
Now the format of P1_STATE will not work in the query. So it's not fetch all results. Is there a way in which the values of the selection list can be used in SQL queries. Thanks for the help.Hello
Try something like:
select * from STATE_REF where ':' || :P1_STATE || ':' LIKE '%:' || LOCATION_ID || ':%'
Andy
-
Dear all,
I have a parameter like below
11000048,11000050
I need to convert in SQL format below, please help me
"11000048","11000050"
' parameter would be so separated by commas, I need to convert in above format, if the parameter is a number say 1111111 must convert it as "1111111" in sql.
Please help me.
Thank you
You can do it
your_parameter: = "" ' | " Replace (your_parameter, ",", "",""). '"';
-
The help of SQL DBMS Flashback AS THE SNA
I would like to use the DBMS Flashback feature in some SQL code to look at the data in a table based on the SNA.
That is to say.
Select ename
of the emp to the SNA 15387125
where empno = 442
I know that the length of time, you can use flashback to the SNA for controllable is (thought of by default is 900 seconds), but I assure you. I have not changed the DB params on my system, and the above statement works longer than 900 seconds.
If I try to go back to something that happened a few days ago that I get:
ORA-01555: snapshot too old: rollback segment number 9 with the name ' _SYSSMU9_3490907396$ ' too small
Can anyone confirm what I watch / set up to the time OF THE SNA.
Thank youAvailable at Flashback depends on how the DB_FLASHBACK_RETENTION_TARGET parameter. By default (in 10G) is 1440 minutes (1 day). [url http://docs.oracle.com/cd/B19306_01/server.102/b14237/initparams050.htm#REFRN10233] To learn more.
Unless you have a particularly parsimonious DBA you must have considerably longer than a quarter of an hour. But not, of course, "a few days". Although this setting specifies an upper limit, and the window of real flashback could be lower if there has been a lot of activity that has eaten up in the region of flashback.
Cheers, APC
-
With the help of sql filter expression
Hi Experts,
I have a question using "sql expression" in the filters in the responses. Let's say I have a date filter and I wish that the value for this date as max (tablename.colname). Please tell me the syntax for this passage.
Another issue is that I have a date guest data are updated every week we'll tell the data refreshed like this * 01/08/11, 08/08/11 and 15/08/11 *. Now, if I select the 08/08/11 it will display the data
populated on * 08/08/11 * which is ok, but if I select * 09/08/11 to 14/08/11 * it only shows * 08/08/11 * data. Similarly, if the option * 16/08/11 or 16/09/11 * it should show the latest up-to-date data which is * 15/08/11 *.
Thanks in advance.
ChakOK, if that State is limited as of the last update when your selects a date in guest that is beyond / above the last refresh date.
This can be a way to do as below:
– Enter the last updated date in a variable repository. If this variable will always hold a value for the last date discount.
-In guests, capture the date selected by the user in a variable of presentation and to apply the Sub statement in SQL advanced report.DateColumn = case when Timestamp ' @{RBAP} {2011-01-01 00:00:00}'<= valueof("lastrefdate")="" then="" timestamp="" '@{pvar}{2011-01-01="" 00:00:00}'="" else="" valueof("lastrefdate")="">=>
RBAP following your presentation and lastRefDate var is your variable rep containing the last refresh date. What would this statement, if the user selects a date that is less than equal to the last refresh date, then report is filtered from this date. Otherwise, the report will be filtered by the value of the date of the last update.
Thank you
-
Hi all
We have an obligation to state the previous year, current year and values of the year next as a LOV in the ADF page.
This is the query that retrieves the previous year, current year and next year. But the result of this query displays values in 3 columns:
Select (Extract(year from sysdate)-1), extract (year sysdate), (extract (year sysdate) + 1) twice;
Output:
2012 2013 2014
But I want to display them in a single with 3 rows as column:
2012
2013
2014
Please your ideas.
or in the same way
SELECT EXTRACT (YEAR FROM ADD_MONTHS (SYSDATE, 12 *(LEVEL-2)))
OF the double
connect by level<>
-
SEQUENCING WITH THE HELP OF SQL
Hello
I have a requirement such as if my data is as follows
name identity
1 John
2 John
3 jane
4 jimmy
5 jimmy
Jack 6
I need a sequence that looks like
Name seq ID
1 John 1
2 John 1
3 jane 2
4 3 Jimmy
5 jimmy 3
6 Jack 4
and so on
So, I have a suspicion we can use analytics, but cannot set up a query to do this.
Sorry, it of a little naïve but would appreciate a hint...
Thank you
BirdyHi, Birdy,
Birdy says:
HelloI have a requirement such as if my data is as follows
name identity
1 John
2 John
3 jane
4 jimmy
5 jimmy
Jack 6I need a sequence that looks like
Name seq ID
1 John 1
2 John 1
3 jane 2
4 3 Jimmy
5 jimmy 3
6 Jack 4and so on
So, I have a suspicion we can use analytics, but cannot set up a query to do this.
Your right; analytical functions can do that. DENSE_RANK assign a number without gaps, duplicate output when the input is duplicated.
Do you care which name gets seq = 1 and who gets seq = 2? If this isn't the case, you can sort the names alphabetically:SELECT id , name , DENSE_RANK () OVER (ORDER BY name) AS seq FROM table_x ;
In the output you posted, it appears you want what they classified by the id low associated with each name ('Jean' = 1, 'jane' = 3 and so on). You can get the id low with the analytical MIN function:
WITH got_min_id AS ( SELECT id , name , MIN (id) OVER (PARTITION BY name) AS min_id FROM table_x ) SELECT id , name , DENSE_RANK () OVER (ORDER BY min_id) AS seq FROM table_x ;
Analytical functions cannot be nested. In other words, you can not say
... OVER (ORDER BY MIN (id) OVER ...)
That's why I used the got_min_id of the subquery.
-
print the currency compared with the help of sql - sum sum
I want to display summary amount for each ID with the motto inscribed on the amount as
1 US $60
2 GBP 30
create table t1 (id number, currency varchar2 (3), the number of quantity);
insert into t1 values (1, 'USD', 10);
insert into t1 values (1, 'USD', 20);
insert into t1 values (1, 'USD', 30);
insert into t1 values (2, "GBP", 5);
insert into t1 values (2, "GBP", 10);
insert into t1 values (2, "GBP", 15);
Thanks in advanceHello
Can be like that
SELECT id, currency || ' ' || SUM (amount) FROM ta1 GROUP BY id, currency;
see you soon
VT
-
TopLink grid 11g: conversion of SQL queries to the filters of consistency
I would like to know how efficient the conversion of SQL queries for filters of coherence is wen search an object in the cache coherence. TopLink does something as instruction cache cache filters consistency as well? In this regard, you have number of performance?
Thank you very much!
Ming-WenTopLink grid currently has a rudimentary filter cache that allows TopLink to only translate NamedQuery once. This allows TopLink grid to reuse the same filter on subsequent runs of this NamedQuery.
-Gordon -
Test SQL queries (QA Tool)
Hi all
Today, I heard a project on the test of SQL queries.
I always test the queries manually. Through the tables, where clause etc.
I there any QA tool to test SQL queries.
If queries are application based, then how may test us?
Good answer if it exists, so that I could participate in the project.
Thank you and best regards,
Kannan BakerThe demos that I use at the University of Washington are here:
http://www.morganslibrary.org/library.html
under TKPROF -
Hello
How can I find the 10 top sql queries which many high IO, CPU. in oracle db.
I do it in a way that using the command TOP trying to get the PID then I get the sql query by applying the hash value in v$ sqlarea.
Y there is it possible to get directly high consumed IO and CPU with see PID in TOP command.
ThanksHello
try something along the lines of
select c.* from (select disk_reads, buffer_gets, rows_processed, executions, first_load_time, sql_text from v$sqlarea where parsing_user_id !=0 order by buffer_gets/decode(executions,null,1,0,1,executions) desc ) c where rownum < 11; select c.* from (select disk_reads, buffer_gets, rows_processed, executions, first_load_time, sql_text from v$sqlarea order by disk_reads/decode(rows_processed,null,1,0,1,rows_processed) desc ) c where rownum <11;
or even
--Top 10 by Buffer Gets: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, buffer_gets, executions, buffer_gets/executions "Gets/Exec", hash_value,address FROM V$SQLAREA WHERE buffer_gets > 10000 ORDER BY buffer_gets DESC) WHERE rownum <= 10 ; --Top 10 by Physical Reads: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, disk_reads, executions, disk_reads/executions "Reads/Exec", hash_value,address FROM V$SQLAREA WHERE disk_reads > 1000 ORDER BY disk_reads DESC) WHERE rownum <= 10 ; --Top 10 by Executions: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, executions, rows_processed, rows_processed/executions "Rows/Exec", hash_value,address FROM V$SQLAREA WHERE executions > 100 ORDER BY executions DESC) WHERE rownum <= 10 ; --Top 10 by Parse Calls: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, parse_calls, executions, hash_value,address FROM V$SQLAREA WHERE parse_calls > 1000 ORDER BY parse_calls DESC) WHERE rownum <= 10 ; --Top 10 by Sharable Memory: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, sharable_mem, executions, hash_value,address FROM V$SQLAREA WHERE sharable_mem > 1048576 ORDER BY sharable_mem DESC) WHERE rownum <= 10 ; --Top 10 by Version Count: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, version_count, executions, hash_value,address FROM V$SQLAREA WHERE version_count > 20 ORDER BY version_count DESC) WHERE rownum <= 10 ;
You may need to play with the column formatting a bit to show the best results
concerning
Alan
Published by: alanm on December 22, 2008 16:01
-
Hi all
Thank you very much for all the kind support so far.
I have two report (sql query)
I want to add both the sql query
1st sql query
2nd sql queryselect distinct(a.item_number) ,a.quantity - b.quantity from QUANTITY_ONHAND_ATP a,BACKLOG_ATP_LT_CW b where a.item_number = b.item_number order by item_number
In the 1st sql query I have 129 records and in the 2nd query sql, I have 14 records. I want to combine these two sql queries. If the item_number 1st sql query is not there in 2nd and then view it as to 1 sql only.select distinct(wb.item_number) ,wb.quantity - be.quantity ,c.quantity - d.quantity from BACKLOG_WEEK_BEFORE_ATP wb ,BACKLOG_ATP_ET_CW be ,BACKLOG_WEEK_AFTER_ATP c ,BACKLOG_ATP_GT_CW d where wb.item_number = be.item_number and c.item_number = d.item_number and wb.item_number = c.item_number and be.item_number = c.item_number and wb.item_number = d.item_number and be.item_number = d.item_number order by wb.ITEM_NUMBER
Any help how to do that.
Concerning
Published by: User_Apex on July 15, 2011 01:21Use the NVL function:
select q1.item_number, WEEK_BEFORE, nvl(CURRENT_WEEK,0) CURRENT_WEEK, nvl(WEEK_AFTER,0) WEEK_AFTER (...)
-
How to find the primary key columns in the tables in MS Access using SQL queries
How to find the primary key columns in the tables in MS Access using SQL queries
Hello
This is the forum for Windows Vista programs related issues.
For better assistance, please try instead the Forums in SQL Server .
Thank you! Vincenzo Di Russo - Microsoft MVP Windows Internet Explorer, Windows Desktop Experience & security - since 2003. ~ ~ ~ My MVP profile: https://mvp.support.microsoft.com/profile/Vincenzo
-
Hello
I am new to oracle. Need some advice on how we should approach to problems of performance especially for SQL queries running slow on the database.
Thanks in advance.
6e85b3c2-5f02-40CB-A8AD-d2279f63b4be wrote:
Hello
I am new to oracle. Need some advice on how we should approach to problems of performance especially for SQL queries running slow on the database.
Thanks in advance.
Start here; http://docs.Oracle.com/CD/E11882_01/server.112/e10822/TOC.htm
Continue here: http://docs.oracle.com/cd/E11882_01/server.112/e41573/toc.htm
-
How to find the sql queries executed in one day with the sql and runtime text
Hi Experts,
Please tell me the sql query to find out the queries executed on a particular day and the runtime and the sql text of the query.
Please reply urgent.
Thanks in advance
Database instance 'A' may have run 100 SQL queries today. As for the instance of database 'B' could have exploited queries SQL 1 million today. Instance of database 'B' to 'keep' the 1 million SQL statements - in memory or on disk do you expect? Of course not. There the age or flush or invalidate memory SQL statements. He can't keep them on the disk (imagine running a completely different set of 1.2million SQL statements tomorrow and 1.3 the next day).
AWR and StatsPack can make counts the number of "n" top of the page ("n" default to 30) SQL statements which are still present in the cache of the library (not years, rinsed, invalidated) when a snapshot was taken. They can't declare "all" SQL statements.
To return to your needs. WHY do you need all the SQL statements? Or are there only certain operations specific SQL would you be interested? Could they have been treated by allowing audit (for example, UPDATE and DELETE with EXTENDED verification instructions)?
Hemant K Collette
Maybe you are looking for
-
Need to change or remove the user name?
Hello I have created a username of support or forum for the community and was signed to automatically by using the ID of the evil of apple. Remove the current user name? If I change it very well, but deletion is also an option if I can create a new
-
Installation of windows xp on Compaq Presario CQ50-105EW
Hello, I need drivers for my laptop for windows xp please help me
-
How are you supposed to activate your windows vista professional when he made a mistake 0x8007232B
I tried to change my product key, but it still has the same error
-
Hard drive or a software failure
HelloAcer Aspire laptopVista operating system350 GB drive partitioned. My sister's laptop wouldn't restart. He kept coming up with the windows repair that does not work then. Could not even start in safe mode. Tried all sorts of things after advice f
-
OK, so we can open a session to the iDrac perfectly well when you use the IP address in the address bar, but when we use DNS it will keep the login page reloading (put username and password and accepts the charges and then to the top of the page of c