简体   繁体   中英

How this function works? - Oracle

I have just started using Oracle procedures, using following procedure(made by our DBA department) in my code but having difficulty in understanding this procedure, I have googled a lot and read tutorials but still have confusion.

If anyone could explain this to me, I would really be gratefull.

 function SF_MY_IDENTITY(name IN VARCHAR2, fName in VARCHAR2 class in VARCHAR2,std_Id in VARCHAR2)return UD_CURSOR
is
cursorReturn UD_CURSOR;
grNo VARCHAR(100);
phone VARCHAR(100);

 begin

In above part I couldn't figure out what is this 'is' doing?what it is being used for?

 Open cursorReturn for
            SELECT
            grNo,
            phone
            FROM
                MY_SCHOOL MS
            WHERE
                MS.std_id=std_Id
                 AND MS.name=name
                 AND MS.fNameE=fName;

What is this part doing, what does open doing? and how the output variables 'grNo, phone' would be used in an irrelevant table(MY_SCHOOL)

1) The "is" token is part of the function definition in pl/sql 2) Opens a sql cursor.

I highly recommend that you read a book about pl/sql. For instance the oracle documentation.

It just takes few inputs and based on the input values it opens a cursor and returns it back.

But there is some comma missing and the code is incomplete. Based on what you have posted, this is what the function is doing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM