Skip to content
Advertisement

ORA-06553: PLS-801:Internal Error [55018]

I want to make a function call like SELECT URUN_GETIR('test1') FROM DUAL; but i got ORA-06553: PLS-801: Internal Error [55018].

I tried ORA-06553: PLS-801: internal error [55018] when testing function returning ROWTYPE this like for ex URUN_GETIR(‘test1’).KULUSERNAME but getting same error. It didn’t work for me.Thanks in advance.

My db table :

enter image description here

My plsql function code :

create or replace FUNCTION URUN_GETIR(KULADI VARCHAR2)
RETURN URUN%ROWTYPE
AS
URUN_TABLO URUN%ROWTYPE;
BEGIN
SELECT * INTO URUN_TABLO FROM URUN ur WHERE ur.kulusername = KULADI;
RETURN URUN_TABLO;
END;

enter image description here

Advertisement

Answer

You can achieve your goal with using table functions. Other than that you can not call directly your function like you wanted. Here is another choice for you Use Stackoverflow Wisely

CREATE TABLE URUN
(
   CREATED_BY     VARCHAR2 (50 CHAR),
   CREATED_DATE   DATE,
   UPDATED_BY     VARCHAR2 (50 CHAR),
   KULUSERNAME    VARCHAR2 (50 CHAR),
   ID             NUMBER (10)
);

INSERT INTO URUN (CREATED_BY, CREATED_DATE, UPDATED_BY, KULUSERNAME, ID) VALUES('TEST1',TO_DATE('19000101','YYYYMMDD') ,'TTEST1','USER1',1);COMMIT;
INSERT INTO URUN (CREATED_BY, CREATED_DATE, UPDATED_BY, KULUSERNAME, ID) VALUES('TEST2',TO_DATE('19000102','YYYYMMDD') ,'TTEST2','USER2',2);COMMIT;
INSERT INTO URUN (CREATED_BY, CREATED_DATE, UPDATED_BY, KULUSERNAME, ID) VALUES('TEST3',TO_DATE('19000103','YYYYMMDD') ,'TTEST3','USER3',3);COMMIT;
INSERT INTO URUN (CREATED_BY, CREATED_DATE, UPDATED_BY, KULUSERNAME, ID) VALUES('TEST4',TO_DATE('19000104','YYYYMMDD') ,'TTEST4','USER4',4);COMMIT;

CREATE OR REPLACE TYPE URUN_OBJ AS OBJECT
(
   CREATED_BY VARCHAR2 (50 CHAR),
   CREATED_DATE DATE,
   UPDATED_BY VARCHAR2 (50 CHAR),
   KULUSERNAME VARCHAR2 (50 CHAR),
   ID NUMBER (10)
);


CREATE OR REPLACE TYPE URUN_OBJ_TAB AS TABLE OF URUN_OBJ;

CREATE OR REPLACE FUNCTION URUN_GETIR (KULADI IN VARCHAR2)
   RETURN URUN_OBJ_TAB
   PIPELINED
AS
   REC_OBJ   URUN_OBJ;

   CURSOR DATA
   IS
      SELECT *
        FROM URUN UR
       WHERE UR.KULUSERNAME = KULADI;
BEGIN
   FOR REC IN DATA
   LOOP
      REC_OBJ :=
         URUN_OBJ (REC.CREATED_BY,
                   REC.CREATED_DATE,
                   REC.UPDATED_BY,
                   REC.KULUSERNAME,
                   REC.ID);
      PIPE ROW (REC_OBJ);
   END LOOP;

   RETURN;
END;
/


SELECT * FROM   TABLE(URUN_GETIR('USER1'));

CREATED_BY  CREATED_DATE    UPDATED_BY  KULUSERNAME ID
TEST1   1.01.1900   TTEST1  USER1   1
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement