I'm new to pl/sql ! I'm trying to sort a table of records, using a simple bubble-sort algorithm. What is the problem?
Where could I find more information about using table of records ?
DECLARE
text VARCHAR2(50);
TYPE TIP_VECTOR
IS
TABLE OF INT INDEX BY BINARY_INTEGER;
TYPE contorRecord
IS
record
(
codASCII VARCHAR2(3),
contor SMALLINT);
TYpe tip_vector2
IS
TABLE OF contorRecord;
VECTOR TIP_VECTOR;
VECTOR2 TIP_VECTOR2 := TIP_VECTOR2();
aux tip_vector2 := tip_vector2();
v_char VARCHAR2(3);
FLAG BOOLEAN := TRUE;
t smallint;
n SMALLINT := 1;
ind SMALLINT := 0;
begin
AUX.EXTEND(1);
WHILE(FLAG)
LOOP
FLAG := FALSE;
-- here is the problem; what i'm doing wrong?
FOR I IN 1..(vector2.count-1) LOOP
-- here is the problem; what i'm doing wrong?
IF VECTOR2(I).CONTOR < VECTOR2(I+1).contor THEN
AUX := VECTOR(I+1);
VECTOR(i+1) := VECTOR(I);
VECTOR(I) := AUX;
FLAG := TRUE;
END IF;
END LOOP;
END LOOP;
end;
Error:
Error report:
PLS-00382: expression is of wrong type
PL/SQL: Statement ignored
PLS-00382: expression is of wrong type
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action: