Callin SQL Gurus Chalanachithram.com | Topics | Search
Hide Clipart | Log Out | Register | Edit Profile

Last 30 mins | 1 | 2 | 4 hours     Last 1 | 7 Days

Chalanachithram.com DB » TF Industry related » Archive through January 28, 2010 » Callin SQL Gurus « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Kdnumber1
Side Hero
Username: Kdnumber1

Post Number: 4649
Registered: 02-2009
Posted From: 76.24.180.51

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 26, 2010 - 07:30 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

Reply ichina andariki Thanks......ma mgr ki kudaradu nuvvu report la adugutnnav ani cheppa...he satisfied
Top of pagePrevious messageNext messageBottom of page Link to this message

Maverick
Hero
Username: Maverick

Post Number: 12715
Registered: 01-2008
Posted From: 192.146.101.71

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 26, 2010 - 06:27 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

may not be the best..but works

create or replace FUNCTION rowtranspose( p_in_stmt IN VARCHAR2,
p_dlmtr IN VARCHAR2 DEFAULT ',' ) RETURN VARCHAR2
AUTHID CURRENT_USER AS
TYPE c_refcur IS REF CURSOR;
out_str VARCHAR2(4000);
out_colval VARCHAR2(4000);

c_dummy c_refcur;

BEGIN
OPEN c_dummy FOR p_in_stmt;
LOOP

FETCH c_dummy INTO out_colval;
EXIT WHEN c_dummy%NOTFOUND;

out_str := out_str || p_dlmtr || out_colval;

END LOOP;
CLOSE c_dummy;

RETURN SUBSTR(out_str,2);

EXCEPTION
WHEN OTHERS THEN
out_str := SQLERRM;

IF c_dummy%ISOPEN THEN

CLOSE c_dummy;

END IF;


RETURN out_str;
END;

Create the above function and then fire this sql

SELECT distinct rowtranspose('SELECT DESCRIPTION FROM TABLE2') FROM DUAL
UNION ALL
select column1 ||','|| column2 ||','|| column3 FROM TABLE1;
Top of pagePrevious messageNext messageBottom of page Link to this message

Maharshi
Junior Artist
Username: Maharshi

Post Number: 701
Registered: 02-2008
Posted From: 76.124.134.5

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 26, 2010 - 06:14 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Kdnumber1:

ippudu t1 nundi rows select chesukunte
SNo, Name, Sex ani row headings ravali etta??




idi konchem explan cheyi ..exact ga ela kavalao , danni batti cheppachu
Top of pagePrevious messageNext messageBottom of page Link to this message

Maverick
Hero
Username: Maverick

Post Number: 12714
Registered: 01-2008
Posted From: 192.146.101.71

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 26, 2010 - 06:01 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

is it for display or extracting data? second case aite, dump to 2 files..append the second one
Top of pagePrevious messageNext messageBottom of page Link to this message

Life_sucks
Comedian
Username: Life_sucks

Post Number: 1469
Registered: 05-2008
Posted From: 148.168.40.4

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 26, 2010 - 05:59 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

t1 metadata techukunte column headers vasthayi. tharvatha T2 rows ki map cheyyi.
Top of pagePrevious messageNext messageBottom of page Link to this message

Maharshi
Junior Artist
Username: Maharshi

Post Number: 700
Registered: 02-2008
Posted From: 76.124.134.5

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 26, 2010 - 05:56 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

Select col1 as 'SNO', Col2 as 'Name', Col3 as 'Sex'
from T1
Top of pagePrevious messageNext messageBottom of page Link to this message

Venkateswarlu
Junior Artist
Username: Venkateswarlu

Post Number: 352
Registered: 01-2010
Posted From: 162.116.29.69

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 26, 2010 - 04:01 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

I use Proc Sql in SAS .. To get heading, I use label statement..

Proc sql;
create table T as
select col1 label='SNO', col2 label='Name'
from t1
;
quit;
In this db, there's always someone watching you!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Kdnumber1
Side Hero
Username: Kdnumber1

Post Number: 4648
Registered: 02-2009
Posted From: 65.120.124.222

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 26, 2010 - 03:58 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

i hv 1 table t1(col1,col2,col3)

2nd table t2(colName,description), denilo rows like
col1 - SNo
col2 - Name
col3 - Sex

ippudu t1 nundi rows select chesukunte
SNo, Name, Sex ani row headings ravali etta??

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image HASH(0x92b2648){Movie Clipart}
Show / Hide regular icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Show / Hide Filmy icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  


Username: Posting Information:
This is a public posting area. Enter your username and password if you have an account. Otherwise, enter your full name as your username and leave the password blank. Your e-mail address is optional.
Password:
E-mail:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: