Skip to Content

Below example 1 how you create a READ ONLY procedure.

EXAMPLE 1

/*** Procedure Script ***/

CREATE PROCEDURE “KN227869”.“TEST_READONLY”()

LANGUAGE SQLSCRIPT READS SQL DATA AS

BEGIN

Q_OUT = SELECT YEAR FROM “KN227869”.“CAL”;

END;

When writing a read only procedure DML statements are not allowed. Below example 2 is a read only procedure with a DML statement. When the procedure is executed you will receive an error message as denoted below

EXAMPLE 2

/*** Procedure Script ***/

CREATE PROCEDURE “KN227869”.“TEST_READONLY”()

LANGUAGE SQLSCRIPT READS SQL DATA AS

BEGIN

Q_OUT = SELECT YEAR FROM “KN227869”.“CAL”;

insert into “KN227869”.“CAL” values (‘2012’,‘4’,‘3’,’10’);

insert into “KN227869”.“CAL” values (‘2012’,‘4’,‘3’,’11’);

END;


/*** ERROR MESSAGE: ***/


/**** SAP DBTech JDBC: [7] (at 138): feature not supported:  INSERT/UPDATE/DELETE are not supported in the READ ONLY procedure/function: line 5 col 1 (at pos 138)

****/

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. aman pratap

    Remove READS DATA AS from the code:

    Remove the STRIKE THROUGH LINE

    CREATE PROCEDURE “KN227869”.“TEST_READONLY”()

    LANGUAGE SQLSCRIPT READS SQL DATA AS

    BEGIN

    Q_OUT = SELECT YEAR FROM “KN227869”.“CAL”;

    END;

    CORRECT WAY:

    CREATE PROCEDURE “KN227869”.“TEST_READONLY”()

    LANGUAGE SQLSCRIPT AS

    BEGIN

    Q_OUT = SELECT YEAR FROM “KN227869”.“CAL”;

    END;

    (0) 

Leave a Reply