Question

Calling a procedure or function from IFS Base functionality

  • 26 August 2021
  • 9 replies
  • 480 views

Userlevel 4
Badge +9

Hi,

I want to call a procedure from an IFS Database task to populate a table. The procedure is a custom one I created myself. If I create it within a package I can get to it by going to  “IFS Base Functionality “ in the “Select method” option in the Database Task. I can find the package in there (see attached image; Base Func.png). But if I create the procedure outside of a package (in the “procedures” section in the Oracle db) how do I find it in IFS Base Functionality? Can I even do that? Is it only possible to call packages from IFS Base functionality? I would like to be able to access custom made functions and procedures from IFS Base Functionality, not just packages.

If anyone can tell me how to do that it would be great, thank you.

 


This topic has been closed for comments

9 replies

Userlevel 5
Badge +8

Hi @jdoherty,

The step by step process of using custom procedure for database task is explained in the below link. 

 

Userlevel 4
Badge +9

Hi @jdoherty,

The step by step process of using custom procedure for database task is explained in the below link. 

 

That explains how to call a procedure from within an API. I don’t want to call it from within an API, I want to call it from outside an API,, one just created in the Oracle db in the normal way .

Userlevel 5
Badge +8

Hi @jdoherty ,

According to IFS standards it is not possible because in order to select a method from there you need to have a logical unit and a package (api).

https://docs.ifs.com/techdocs/foundation1/045_administration_aurena/230_bckgrnd_processing/020_database_tasks_itd/default.htm

Thanks & Best Regards,

Wimali

Userlevel 4
Badge +9

Hi @jdoherty ,

According to IFS standards it is not possible because in order to select a method from there you need to have a logical unit and a package (api).

https://docs.ifs.com/techdocs/foundation1/045_administration_aurena/230_bckgrnd_processing/020_database_tasks_itd/default.htm

Thanks & Best Regards,

Wimali

Thanks, that article is referring to Aurena though. I want to create the procedure in IFS EE. I assume it will not allow me to create it in EE either.

Userlevel 5
Badge +8

Hi @jdoherty ,

sorry for giving Aurena link the correct one is given below. but the concept is same. 

https://docs.ifs.com/techdocs/foundation1/040_administration/230_bckgrnd_processing/020_database_tasks/default.htm#Task_Registration

 

Userlevel 4
Badge +9

Hi @jdoherty ,

sorry for giving Aurena link the correct one is given below. but the concept is same. 

https://docs.ifs.com/techdocs/foundation1/040_administration/230_bckgrnd_processing/020_database_tasks/default.htm#Task_Registration

 

That’s OK, no prob. The only reason I don’t like calling procedures from within IFS packages is that I have to recompile the package when I add a  new procedure to it and other procedures within the package are being accessed at the time of compilation and the compile gets stuck.  I have to wait until everyone is out of the db. That would not occur with a standalone procedure.

Userlevel 5
Badge +8

Hi @jdoherty ,

Then you can create a new custom package rather than using a existing package :relaxed:

 

Userlevel 6
Badge +12

Hi @jdoherty ,

sorry for giving Aurena link the correct one is given below. but the concept is same. 

https://docs.ifs.com/techdocs/foundation1/040_administration/230_bckgrnd_processing/020_database_tasks/default.htm#Task_Registration

 

That’s OK, no prob. The only reason I don’t like calling procedures from within IFS packages is that I have to recompile the package when I add a  new procedure to it and other procedures within the package are being accessed at the time of compilation and the compile gets stuck.  I have to wait until everyone is out of the db. That would not occur with a standalone procedure.

 

I never thought about that advantage to Procedures (vs. Packages). Packages appear to be superior in just about every other way.

I assume that when you are developing/testing new functionality you are able to use a DEV or TEST environment -- compiling should be easier there, yes? Modularizing packages will help, too, as more packages means it is less likely that you are re-compiling code that is in-use. Finally, when you are ready to deploy the change to PROD, try it after hours or during other scheduled maintenance. That development workflow should probably be controlled in some way, regardless.

Not sure how much Package development you have done, but be sure to develop (and source control) separate files for the Package spec and body -- do not edit the spec and body directly in Oracle and compile in place. The main reason for this is that if multiple developers are working in one Package you can quickly run into data loss and versioning issues: 

https://stevenfeuersteinonplsql.blogspot.com/2016/09/plsql-101-save-your-source-code-to-files.html

 

Good luck!

Joe Kaufman

Userlevel 7
Badge +18

 

when I add a  new procedure to it and other procedures within the package are being accessed at the time of compilation and the compile gets stuck

You won’t get this issue if you remove the global variables. You will need them there so the dictionary cache gets updated and assigns your package to a module and logical unit, but the process that reads the code doesn’t mind if they’re commented out.

Lesson Learned: How to avoid ORA-04068: "existing state of packages has been discarded" | IFS Community

 

Creating a new package is a little bit of a pain. If you follow the example I put here, with the tweak I just mentioned, it includes all the extra steps that are necessary.

Is there a way to run Custom APIs as scheduled database tasks ? | IFS Community