简体   繁体   中英

Oracle. Execute stored procedure on creation of the view

I have a view with a certain field . Now I need to modify this field accordingly to some logic. I've implemented this logic in a stored procedure .

Now I want to execute this stored procedure and its result should be placed in a field of a view .

Procedure looks like this:

CREATE OR REPLACE PROCEDURE "ORDTEST"."DEPARTMENT_FULLPATH"
(depId IN VARCHAR2, path OUT VARCHAR2)
...

So it has one input parameter and one output parameter.

In a view I need something like this:

CREATE OR REPLACE VIEW kcv_journal_contract_reg AS
   ...
   SELECT DEPARTMENT_FULLPATH(field1),
   ...

Yegoshin Maxim given good solution for this.

you can return the desired value inplace of OUT parameter..

create or replace function "ORDTEST"."DEPARTMENT_FULLPATH" (depId IN VARCHAR2)
return VARCHAR2 as 
....
return path ;

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