Loop in pl/sql loop

Get new comments by email
You can cancel email alerts at anytime.
Comments (1)

Tvojmuc in Europe

57 months ago

Hi all!
I'm new here but I have one hard question :lol:
There is sql for inserting some data in different tables.
[code]

DECLARE

TYPE Parameter_Plt IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER;

Partext VARCHAR2(2000);
Parnaid NUMBER;
Returnwert NUMBER;
Fieldcontent Parameter_Plt;
Textstring VARCHAR2(4000);
Satzzaehler NUMBER := 0;
Recordtype NUMBER;
Messagetype NUMBER;
Intestmode BOOLEAN;

FUNCTION Parameter2string RETURN VARCHAR2 IS

Zaehler NUMBER := 0;
Textstring VARCHAR2(4000);
Indexwert NUMBER;

BEGIN

Indexwert := Fieldcontent.FIRST;
Satzzaehler := Satzzaehler + 1;

WHILE Indexwert IS NOT NULL
LOOP

Zaehler := Zaehler + 1;
Textstring := Textstring || '#' || Lpad(Indexwert, 3, '0') || '@' ||
Lpad(Nvl(Length(Fieldcontent(Indexwert)), 0), 3, '0') || '/' ||
Fieldcontent(Indexwert);

Indexwert := Fieldcontent.NEXT(Indexwert);
END LOOP;

Textstring := Lpad(Zaehler, 3, '0') || Textstring;

Fieldcontent.DELETE;
RETURN Textstring;
END;----------------------------------------------------------1

PROCEDURE Insertrecord IS
BEGIN
Textstring := Parameter2string;

INSERT INTO Nadatensaptowlt
VALUES
(Parnaid,
Messagetype,
Recordtype,
'BP',
Satzzaehler,
-1,
0,
0,
Textstring);

END;-----------------------------------------------------------2

PROCEDURE Preperation IS
BEGIN
SELECT Maxkeynaid_Saptowlt_Sequence.NEXTVAL
INTO Parnaid
FROM Dual;

INSERT INTO Nainfosaptowlt
VALUES
(Parnaid,
Messagetype,
2001,
-1,
0,
NULL,
0,
0,
SYSDATE,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);

- Was this comment helpful? Yes / No Reply - Report abuse

» Sign in or create an account to comment on this topic.