Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select with loop

Status
Not open for further replies.

hudo

Programmer
Dec 4, 2003
94
DE
Have the following table

CREATE TABLE mytable (
PK1 NUMBER,
PK2 NUMBER,
ARRAY NUMBER,
DESCRIPTION VARCHAR2(20)
);

ALTER TABLE mytable ADD(
PRIMARY KEY (PK1,PK2)
);

INSERT INTO mytable(PK1,PK2,ARRAY,DESCRIPTION)
VALUES (1,1,3,'DESC_3');
INSERT INTO mytable(PK1,PK2,ARRAY,DESCRIPTION)
VALUES (1,1,4,'DESC_4');
INSERT INTO mytable(PK1,PK2,ARRAY,DESCRIPTION)
VALUES (1,2,2,'DESC_2');
INSERT INTO mytable(PK1,PK2,ARRAY,DESCRIPTION)
VALUES (2,1,1,'DESC_1');
INSERT INTO mytable(PK1,PK2,ARRAY,DESCRIPTION)
VALUES (2,1,3,'DESC_3');
INSERT INTO mytable(PK1,PK2,ARRAY,DESCRIPTION)
VALUES (2,2,3,'DESC_3');

Would like to have to following strings:

for PK1=1,PK2=1 : v_result := <TAG></TAG><TAG></TAG><TAG>DESC_3</TAG><TAG>DESC_4</TAG>;
for PK1=1,PK2=2 : v_result := <TAG></TAG><TAG>DESC_2</TAG><TAG></TAG><TAG></TAG>;
for PK1=2,PK2=1 : v_result := <TAG>DESC_1</TAG><TAG></TAG><TAG>DESC_3</TAG><TAG></TAG>;
for PK1=2,PK2=2 : v_result := <TAG></TAG><TAG></TAG><TAG>DESC_3</TAG><TAG></TAG>;



 
Hudo,
what is the purpose of v_result? Also what does ur code intends to achieve?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top