im just trying to find out how I can return MULTIPLE Primary Keys Columns from a table in one DBMS OUTPUT LINE....
In a table I have the following...
The code for my function is:
CREATE OR REPLACE FUNCTION Get_Constraint_Columns(
/*
* Oct 10th, 2021
* Return the column names that make up a PK constraint and columns that make up unique constraint.
*/
iTable VARCHAR2, iConstraint VARCHAR2
)
RETURN VARCHAR2
AS
wReturn VARCHAR2(30);
CURSOR ColumnSelected IS
SELECT Column_Name
FROM User_Cons_Columns
WHERE Table_Name = iTable AND Constraint_Name = iConstraint
ORDER BY Position;
CurrentRow User_Cons_Columns%ROWTYPE;
BEGIN
FOR CurrentRow IN ColumnSelected LOOP
wReturn := (CurrentRow.Column_Name);
RETURN wReturn;
END LOOP;
END;
/
When that function is called and a report is SPOOLED i get:
When I need it to look like:
Where it has BOTH column names...(MFR, PRODUCT) I've moved things around in the code and tried different things but it either ends with the same result or errors. I would be forever appreciative if someone might be able to point me in the right direction. Thanks in advance!