Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Call a shared library with PL/SQL

Posted on 2009-07-09
3
364 Views
Last Modified: 2013-12-07
Hi,
i have a provided shared library which i need to call from within an PL/SQL procedure.

i got the the following from the vendor:

int functionxy( int arg0, int arg1, time_t arg2, const char *arg3, size_t arg4, char *arg5 )

so i'm not sure how to create/define the procedure in oracle, i was thinking of something like this:

CREATE OR REPLACE FUNCTION myFunction
    (arg0 IN PLS_INTEGER,
     arg1 IN PLS_INTEGER,
     arg2 IN PLS_INTEGER,
     arg3 IN CHAR,
     arg5 IN OUT CHAR)
RETURN PLS_INTEGER AS LANGUAGE C
    NAME "functionxy"
    LIBRARY myLib
    PARAMETERS (
        arg0,
        arg1,
        arg2,
        arg3,
        arg3 LENGTH,
        arg5
    );        

does this look correct so far? i'm really unsure on how to use the time_t type...

any help is appreciated.

thanks
Lukas    
0
Comment
Question by:lukas_ch
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 250 total points
ID: 24813186
You'll need to check the specific implementation of time_t for your library.

In most c implementations time_t  is a int or  long int.  So pls_integer will correspond fine.

In your pl/sql code you will probably want to convert the integer value into a date.

you can do that with the following calculation...

 TO_DATE('1970-01-01', 'yyyy-mm-dd') + (your_time_t_value/ 86400)
0
 

Author Comment

by:lukas_ch
ID: 24858098
sorry, took a little longer to test, as i had to sort out some OS issues...

the function worked on the first try! also the remark about calculating time_t helped me :-)

thanks.
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 24859049
would else did you need for me to earn an A?

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question