How to get result as below
Hello all,
I have situation like below
OrgID
Merge_OrgId
1
2
2
3
3
4
5
6
6
7
8
9
expected result is
OrgID
Merge_OrgId
1
4
5
7
8
9
example 1->2->3->4 means 1 -> 4
please tell me how to write sql query of such
Hi Janani
First of all, I want to say in any case well done for posting your answer! I hope to see more and more people trying to help others even if not sure that they have the best answer. Maximum you will learn from comments that your solution
will get, and next time you will be the first to provide the help :-) Well done!
Now if I may say some words on the solution that you posted:
In most cases you don't need to build new tables, just for selecting existing rows. In your solution you build 2 tables just in order to select the values which you already have in the original table.
Think about a real databases where a table can be 30GB of data. will you copy this table twice every time that you execute a select query? select query might be execute 100k times in a second, but no disc will be able to write 30GB in a second...
I recommend as first step every time that you want to use something like "SELECT OrgID INTO t1 FROM T" as part of a select, to:
try to think on a direct option without the use a helper table
If must then you can use a dynamic table like CTE
if even CTE will not work and you have to build a table then at least make sure this is a temporary table.
I hope this is useful :-)
[Personal Site] [Blog] [Facebook]
Similar Messages
-
hi
i created a java source coded below
CREATE OR REPLACE JAVA SOURCE
NAMED "Welcome"
as import java.lang.*;
public class Welcome
public static void main(String s[])
System.out.println("Welcom to java");
java created.
but how to get the result "welcome to java"
how call or execute Welcome class file.
thanks any one help
byeTry this:
CREATE OR REPLACE JAVA SOURCE NAMED Welcome
as
import java.lang.*;
class Welcome
public static void main(String s[])
System.out.println("Welcome to java");
CREATE OR REPLACE PROCEDURE welcome
AS LANGUAGE JAVA NAME 'Welcome.main(java.lang.String[])';
set serveroutput on
call dbms_java.set_output(2000);
exec welcome; -
How to get result without single cotes in ''Cast(Multiset( '' Result.
select cast(multiset(select column_name
from user_tab_columns
where table_name = 'DAILY_PRODN_MIS'
and column_name like '%STOCK%'
order by column_name) as tab_type) result from dual;
RESULT
TAB_TYPE('BAGS_STOCK', 'BLUE_DUST_STOCK', 'CEMENT_STOCK', 'CEMENT_STOCK_33', 'CEMENT_STOCK_43', 'CEMENT_STOCK_53', 'CK_ADJ', 'COAL_IND_D_STOCK', 'COAL_IND_D_STOCK_ADJ', 'COAL_IND_E_STOCK', 'COAL_IND_E_STOCK_ADJ', 'COAL_IND_F_STOCK','OCK_ADJ', 'MTD_COAL_IMP_D_STOCK_ADJ', 'MTD_COAL_IMP_E_STOCK_ADJ', 'MTD_COAL_IND_A_STOCK_ADJ', 'MTD_COAL_IND_B_STOCK_', 'YTD_COAL_IMP_B_STOCK_ADJ', 'YTD_COAL_IMP_C_STOCK_ADJ', 'YTD_COAL_IMP_D_STOCK_ADJ', 'YTD_COAL_IMP_E_STOCK_ADJ')
How can i get result without single cotes for each column.Your query currently returns a collection type (tab_type) whereas it appears you want to return a delimited string.
There are actually quite a few ways to achieve this - with your own function, with a user-defined aggregate functions (e.g. Tom Kyte's stragg), with the MODEL clause or with CONNECT BY, e.g.
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> SELECT table_name,
2 SUBSTR (MAX (SYS_CONNECT_BY_PATH (
3 column_name, ',')), 2) column_names
4 FROM (SELECT table_name, column_name,
5 ROW_NUMBER () OVER (
6 PARTITION BY table_name
7 ORDER BY column_id) column_order
8 FROM user_tab_columns
9 WHERE table_name = 'BANK_ACCOUNT'
10 AND column_name LIKE '%U%') utc
11 START WITH column_order = 1
12 CONNECT BY column_order = PRIOR column_order + 1
13 AND table_name = PRIOR table_name
14 GROUP BY table_name;
TABLE_NAME COLUMN_NAMES
BANK_ACCOUNT ACCOUNT_NAME,ACCOUNT_NUMBER
SQL> -
How to get result of PING whether TRUE/FALSE and prompt message to user?
Hi all!!!!
In Forms 6i, I need to know how to get the result of a ping if the ping is sucessful or not. It should prompt the user whether the connectivity is there or not after the ping statement which is HOST('PING 191.10.10.40'). As of now, when the user select the desired LOV, the corresponding HOST statement is executed. But if the connectivity is not there, the user is left in blank with a hanging situation... So can we not prompt the user if the connection has been failed or not?
RegardsHi,
You can try this.
Redirect the output of the ping test to a file. Read the file using TEXT_IO and see if the test is passed. For ex
host('ping <your_ip> > c:\ping_test.log');Will redirect the ping output to ping_test.log file under c:\ drive.
Open the file using TEXT_IO and check if you have the text "Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)". If you have, then the host is reachable. Otherwise its not. Depending on that, you can change the flow of your application.
-Arun -
How to get result of Select from stored function.
I need to get result of select from a stored function.
In the end of my stored function I makes final select (four columns).
How it can be retrived from function?Hi,
A function can only return one value, but it sounds like you want to return 4 values.
The one value that you return can be a record, with many columns, such as a ROWTYPE, or a TYPE that you define.
You can return an XMLTYPE that has whatever elements you want.
You can write a procedure that has several OUT parameters. (You can have OUT parameters in a function, but a lot of people find that confusing.)
In very special circumstance, you might consider returning a string that is a delimited list of values, such as '7639,SMITH,,17-DEC-1980'.
Someoneelse has a good point.
We could give a better answer if you ask a specific question, like:
"I have this table ...
I want a function such that, if I call it with these parameters ... I get ...
but if I call it like this ... then I get ..." -
Hi all,
Please tell me how to get the below required out put.
this is my table and data
with t as (select 11 plcy,1 nm from dual union all
select 11 plcy,2 nm from dual union all
select 11 plcy,3 nm from dual union all
select 11 plcy,5 nm from dual union all
select 22 plcy,1 nm from dual union all
select 22 plcy,2 nm from dual union all
select 22 plcy,3 nm from dual union all
select 33 plcy,1 nm from dual union all
select 44 plcy,2 nm from dual union all
select 55 plcy,4 nm from dual union all
select 66 plcy,3 nm from dual )
select * from t
this my required output.
from above query required output is below
plcy nm
11 5
33 1
44 2
55 4
66 3
if pass nm = 5 then 11
if i pass nm= 1 then 33
if i pass nm=2 then 44
if pass nm = 4 then 55
if i pass nm =3 thne 66
it means it has only one value from plcy
11 5
33 1
44 2
55 4
66 3
thanks,Something like this:
SQL > with t as (select 11 plcy,1 nm from dual union all
2 select 11 plcy,2 nm from dual union all
3 select 11 plcy,3 nm from dual union all
4 select 11 plcy,5 nm from dual union all
5 select 22 plcy,1 nm from dual union all
6 select 22 plcy,2 nm from dual union all
7 select 22 plcy,3 nm from dual union all
8 select 33 plcy,1 nm from dual union all
9 select 44 plcy,2 nm from dual union all
10 select 55 plcy,4 nm from dual union all
11 select 66 plcy,3 nm from dual
12 )
13 SELECT MAX(plcy) plcy
14 , NM
15 FROM t
16 GROUP BY NM
17 ORDER BY PLCY
18 /
PLCY NM
11 5
33 1
44 2
55 4
66 3 -
How to get result of MDM validation expression with type warning?
I need to get result of MDM validation expression with type WARNING (in automatic execution),
but - method validationResult.getFailedValidations(..) returns validation if it has type ERROR,
so all Warnings treated only as success despite it returned false or true.
My question - how can I get that 'false or true' expression resut for validation.
thanksHello Vladimir
By my opinion, hook warning exception isn't make sense because after warning message data will be change(upload).
Moreover if you start validation from WF Warning exception doesn't work at all.
If you want to do some data changes you should use and hook Error exception.
Regards
Kanstantsin Chernichenka -
How to get Result Count Content By Search Webpart (ContentBySearchWebPart)?
I'm writing a webpart that extends the out of the box ContentBySearchWebPart.
Does any one know how to get the search result count from this webpart?
I did not find any property?Hi
Thanks but you are referring to the "Search Webpart". I am referring to the "Content Search" or often called "Content by Search" which is different. It's the one under Content Rollup.
Although very similar they're not - Content Search WP doesn't have that property.
What I am really after is to hide the whole webpart if there are no results coming back. I tried to figure it out and even write a jQuery that would search for the text "There are no results" message which comes from the webpart when result count=0
and hide the parent webpart that way. There will be a short flash once the page loads rendering the webpart for a split second and then disappear by jQuery - which is not great UI experience.
There is this property: "ShouldHideControlWhenEmpty" but it doesn't do anything when there are no results. The webpart is still visible. Webpart has a the Title and the Border around it so when there are no results the title and the border show
up with no results. Like I said I want to hide the whole thing in that case.
So I thought I could extend the OOTB ContentBySearchWebPart and get a hold of some kind property that would get me the result count. If the results count is 0 simply I would hide the webpart server side.
Thoughts? -
hi,
is any possible to get result after click alert view by using [[UIApplication sharedApplication] openURL:@"itms-services://?action=download-manifest&url...
when i close app, the alert view ([[UIApplication sharedApplication] openURL) is aleady exist, is it not uialertview?, i can't find any alert view by
for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows]) {
if ([[keyboardWindow description] hasPrefix:@"<UIALERT"] == YES) {
isExists = YES;
any help, thanks.I have the MS-6968 device and i want to use driver 1.4.x or 3.0.x. I found the driver 1.4.2.10 but i cannot find any WIDCOMMSecurity code.
So, can anyone give me a link for BTWPatcher.exe???
It cannot be found here (Jon's Bluetooth ) anymore.
Thanks -
SUBMIT RFGLBALANCE WITH selection criteria, then How to get resulted itab?
Hi Experts,
Am looking to develop a similar report which is doing by SAP at detail/item level, but am looking to develop a SUMMARY level.
SAP report is = FS10N (bhind prog. is RFGLBALANCE / RFGLITEMS )
my_alv = shuld show only TOTALS / SUMMARY line
Almost the selection screen is same in both cases.
So, I wanna to use the same prog. by using SUBMIT from my_alv_report.
So, when I use
SUBMIT RFGLBALANCE
WITH ..........................
WITH ........................
AND RETURN.
then, my_alv_report control goes to RFGLBALANCE prog. there my input is processed and the output internal table is populating in RFGLBALANCE.............so, now, I wanna to get / fetch / pull this populated internal table into my_alv_repor and there by using the same for my alv display.
( I know that, if both r Z prog.s/ Z_BAPIs, then, I can use EXPORT & IMPORT )
So, pls. let me know that,
Is it possible ?
If so, How to get it done?
SUBMIT Syntax pls.
thanqthanq.
so, then, Can I use like, *INCLUDE RFGLBALANCE*(Standard Prog.) in my_alv_report, I mean, like
report my_alv_report message-id Z1.
INCLUDE RFGLBALANCE.
own_Logic.
thanq -
How to get result of select query from oracle in VC
Dear All ,
I have a application in oracle which insert the data in the oracle database table.
Now i want to show all the data that has been inserted into the database table in my VC application but i don't know how to handle select query in VC.
Regards
KrishanHi Goivndu
Thanks for your reply .
I know all those things.
I have created the system & alias for my backend oracle system.
I can also see all the stored procedure that are there in my oracle system.
I just want to know how to write a select query in a stored procedure .
you can insert data , Update data through oracle procedure but i don't think there is any way to get the result of select query in stored procedure .
If you know any way to do that please do let me know .
Regards
Krishan -
How to get results of search help window?
Hi, experts,
I have a question here.
For a field vendor id there is pre-defined search help, with which the detailed information of vendor inclusive the vendor id will be returned. But it will only fill this vendor id field. other information in the result like vendor name will be lost. I still need this information for other fields. And I hope to get other fields filled with the info in the results.
How can I get the complete info in the result delivered by search help window?
Can anybody help?
Best regards,
FanIn short you need to fill the other fields on the screen using the same search help.
for that read this thread, Thomas nicely explained the same with an example
Re: Help On Search Help !!!!!
Abhi -
How to get result from another JSP file?
I have to write a jsp (my.jsp) to get information from another jsp file (other.jsp).
The other.jsp return integer value (0 / 1) so that user can tell if certain service is available or not. And in my.jsp I need to collect such result and other information from a text file to make up of a XML string.
How can I call other.jsp to get the result? Thanks a lot.Hi, I think I didn't describe the problem clearly
enough. In fact, there is a JSP file, and if our
database is currently connected, the JSP will return
value 1, otherwise, it will return 0. My java program
need to get that result, and then form an XML string,
and send the string back to the client. I'm just
wonder how can I write such a program to read result
from JSP file. Thanks a lot.Why is this function implemented as a JSP file? It should be implemented as a bean. It would be simple to get the information you require from that bean. -
How to get result from query for ssrs?
DECLARE @meter_number int
SET @meter_number=25112
IF @meter_number IN (SELECT meter_number FROM ods.pmc.meter_registers)
BEGIN
SELECT 'LA' as [data_center]
, t.request_time_gmt
, aca.transaction_id
, aca.meter_number
, CONVERT(date, aca.ship_date_gmt) as ship_date
, aca.user_name
, p.confirmation_number
, p.origin_zip
, p.destination_zip
, p.destination_zip_addon
, p.base_postage_cost
, p.mail_class_id
, p.weight_ounces
, p.delivery_confirmation
, cil.ascending_register
-- , ih.transaction_date_gmt
, ih.from_name, ih.from_company, ih.from_address_line_1, ih.from_address_line_2, ih.from_city, ih.from_state, ih.from_zip
, ih.to_name, ih.to_company, ih.to_address_line_1, ih.to_address_line_2, ih.to_city, ih.to_state, ih.to_zip
FROM ods.sws.create_indicium_log aca --#USPS_Amazon_Cust_Activity aca
JOIN ods.sws.prints p (NOLOCK)
ON aca.transaction_id = p.transaction_id
JOIN ods.sws.transactions t (NOLOCK)
ON aca.transaction_id = t.transaction_id
JOIN ods.sws.create_indicium_log cil (NOLOCK)
ON aca.log_id = cil.log_id
LEFT JOIN ods.pmc.indicium_history ih
ON p.confirmation_number = ih.confirmation_number
END
ELSE IF @meter_number in (SELECT meter_number FROM ods.pmc_dr01.meter_registers)
BEGIN
SELECT 'PHX' as [data_center]
, t.request_time_gmt
, aca.transaction_id
, aca.meter_number
, CONVERT(date, aca.ship_date_gmt) as ship_date
, aca.user_name
, p.confirmation_number
, p.origin_zip
, p.destination_zip
, p.destination_zip_addon
, p.base_postage_cost
, p.mail_class_id
, p.weight_ounces
, p.delivery_confirmation
, cil.ascending_register
, ih.from_name, ih.from_company, ih.from_address_line_1, ih.from_address_line_2, ih.from_city, ih.from_state, ih.from_zip
, ih.to_name, ih.to_company, ih.to_address_line_1, ih.to_address_line_2, ih.to_city, ih.to_state, ih.to_zip
FROM ods.sws.create_indicium_log aca--#USPS_Amazon_Cust_Activity aca
JOIN ods.sws_dr01.prints p (NOLOCK)
ON aca.transaction_id = p.transaction_id
JOIN ods.sws_dr01.transactions t (NOLOCK)
ON aca.transaction_id = t.transaction_id
JOIN ods.sws_dr01.create_indicium_log cil (NOLOCK)
ON aca.log_id = cil.log_id
LEFT JOIN ods.pmc_dr01.indicium_history ih
ON p.confirmation_number = ih.confirmation_number
END
I executed this query it says command completed successfully how can it return results?Hi,
Create a procedure as shown below in the database and while creating the Dataset in SSRS , Select Stored procedure as a source and call this newly created procedure using command EXEC Usp_Meter_Number 25112.
The columns will automatically generated and u can use the columns.
CREATE PROCEDURE Usp_Meter_Number
@meter_number int
AS
BEGIN
IF @meter_number IN (SELECT meter_number FROM ods.pmc.meter_registers)
BEGIN
SELECT 'LA' as [data_center]
, t.request_time_gmt
, aca.transaction_id
, aca.meter_number
, CONVERT(date, aca.ship_date_gmt) as ship_date
, aca.user_name
, p.confirmation_number
, p.origin_zip
, p.destination_zip
, p.destination_zip_addon
, p.base_postage_cost
, p.mail_class_id
, p.weight_ounces
, p.delivery_confirmation
, cil.ascending_register
-- , ih.transaction_date_gmt
, ih.from_name, ih.from_company, ih.from_address_line_1, ih.from_address_line_2, ih.from_city, ih.from_state, ih.from_zip
, ih.to_name, ih.to_company, ih.to_address_line_1, ih.to_address_line_2, ih.to_city, ih.to_state, ih.to_zip
FROM ods.sws.create_indicium_log aca --#USPS_Amazon_Cust_Activity aca
JOIN ods.sws.prints p (NOLOCK)
ON aca.transaction_id = p.transaction_id
JOIN ods.sws.transactions t (NOLOCK)
ON aca.transaction_id = t.transaction_id
JOIN ods.sws.create_indicium_log cil (NOLOCK)
ON aca.log_id = cil.log_id
LEFT JOIN ods.pmc.indicium_history ih
ON p.confirmation_number = ih.confirmation_number
END
ELSE IF @meter_number in (SELECT meter_number FROM ods.pmc_dr01.meter_registers)
BEGIN
SELECT 'PHX' as [data_center]
, t.request_time_gmt
, aca.transaction_id
, aca.meter_number
, CONVERT(date, aca.ship_date_gmt) as ship_date
, aca.user_name
, p.confirmation_number
, p.origin_zip
, p.destination_zip
, p.destination_zip_addon
, p.base_postage_cost
, p.mail_class_id
, p.weight_ounces
, p.delivery_confirmation
, cil.ascending_register
, ih.from_name, ih.from_company, ih.from_address_line_1, ih.from_address_line_2, ih.from_city, ih.from_state, ih.from_zip
, ih.to_name, ih.to_company, ih.to_address_line_1, ih.to_address_line_2, ih.to_city, ih.to_state, ih.to_zip
FROM ods.sws.create_indicium_log aca--#USPS_Amazon_Cust_Activity aca
JOIN ods.sws_dr01.prints p (NOLOCK)
ON aca.transaction_id = p.transaction_id
JOIN ods.sws_dr01.transactions t (NOLOCK)
ON aca.transaction_id = t.transaction_id
JOIN ods.sws_dr01.create_indicium_log cil (NOLOCK)
ON aca.log_id = cil.log_id
LEFT JOIN ods.pmc_dr01.indicium_history ih
ON p.confirmation_number = ih.confirmation_number
END
END
Please have look on the comment -
How to get result of HTTPService within a function?
Hello all,
I'm trying to call an HTTPService's send() and get the
resulting data from within a function, and assigning it locally.
Specifically, this is what I want:
private function getData():void {
myRPC.send();
//How do I set the result of myRPC.send to a variable here?
// Neither myRPC.send().result, nor myRPC.lastResult works! I
get null both times!
// But if I set myRPC.result to a separate function that
handles an event, I get the correct data...but not what I want.
var myObject:Object = ???? myRPC.???
<mx:HTTPService result="???" fault="???" id="myRPC"
method="GET" resultFormat="e4x" url="someurl" useProxy="false">
<mx:request xmlns="">
<somedata>hi</somedata>
</mx:request>
</mx:HTTPService>
I am also not sure what to put in 'result' and 'fault' since
I don't want the result/fault to be passed to another
function...could anyone explain this please? Thanks!"Hamshmam" <[email protected]> wrote in
message
news:g70olu$jcd$[email protected]..
> Hi Greg,
>
> While this is not what I am looking for, thanks for your
response.
>
> I am familiar with traditional HTTPService requests and
passing the
> resulting
> event to a function handle directly and then modifying
the object from
> there.
> However, as I described in my earlier post, I'm looking
for a way to get
> the
> resulting event of the HTTPService.send() within a
different function.
>
> I am doing this because if I have another function
dependent on the
> HTTPService.send()'s data, I cannot simply call the
HTTPService.send()
> from
> within that function and update a class private var with
the data, which I
> access from the wrapping function. This is because the
HTTPService is by
> nature
> asynchronous, so it is possible that the class private
var will remain
> null
> while further lines of code are executed, all the while
the HTTPService is
> interacting with the server concurrently.
>
> I hope it is clear now why I need to assign the result
of a HTTPService
> result
> directly within a function, if you or anyone else could
shed some light on
> that, I would appreciate it! Thanks for your response.
http://www.johnwilger.com/2007/03/future-value-pattern-in-actionscript-3.html
Maybe you are looking for
-
RadioTime App not showing up in Palm's App Catalog for Pre users inside the United States!
Hi, Preware is telling me that there is an update for RadioTime which I purchased from Palm's App Catalog a few months ago. I love this app! However, when I attempt to do the update, the Palm App Catalog is telling me there is no app there! The app s
-
what can i do ?????
-
This question was posted in response to the following article: http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e63e3d11c0bf5f65f-7ff1.ht ml
-
Any way to move the slide workspace?
I'd like to be able to create action moves that start from outside the top and the left edges of a slide. As long as the slide workspace is anchored on the top and left sides, it's close to impossible to accurately start a move from the top or the le
-
Converting UTC dates to local time
Hello all. I have some data I imported that has a date column containing dates spanning a number of years. The dates are in the UTC timezone. I need to display the dates in the local time zone that was in effect at the time. I've seen many fine examp