How can I call a PRO*C program directly from PL/SQL? - sql

I couldn't find a similar question here.
I have a PRO*C program named pro_c.pc. How can I call and execute this in a piece of PL/SQL code?! Could someone give me a simple example?!

You can link external libraries (Windows DLL or UNIX ".so" files) to Oracle and then make them callable via PLSQL. This has been around at least since Oracle 8i.
This though requires DBA privs on the server to set this up, and is probably not a recommended approach these days .... but useful for crunching huge data.
See here for more details.
Calling a actual program directly, as opposed to a library function from PLSQL would be done indirectly via DBMS_SCHEDULER as #Justin suggested as the easiest way, creating a program with the PROGRAM_TYPE as EXECUTABLE. See here for more info.
A couple of things to note when doing this, the program will run as the (assuming UNIX) "oracle" user - bringing with it some security considerations, e.g. if the program creates a file it will be created as owned by oracle, and so might not be accessible to an "application" user. The program will run on the Oracle database server.

Related

How to instrument the modification of register sp in valgrind

I want to track the modification of the x86_64 stack register (sp) by writing a simple valgrind tool. Is there some other tool that tracks modification of sp (or other register modifications) already where I could peek and copy from? I guess that I need to parse the IRStmt tagged Ist_Put and look for Put.offset == offset_SP. Are there tools that already do that? I want to print out the values that are written to SP.
See pub_tool_tooliface.h.
This defines a bunch of 'void VG_(track_new_mem_stack*) functions
and VG_(track_die_mem_stack*) functions to track changes to SP.
Unless you need very high performance tracking (such as needed by memcheck),
it should be good enough to use :
VG_(track_new_mem_stack)
VG_(track_new_mem_stack_signal)
VG_(track_die_mem_stack)
VG_(track_die_mem_stack_signal)

How to create a process permanent file from an application program

How can I create process permanent file (like DCL does) from an application executable (I happen to be coding in Fortran, but I suspect that's not important to the answer).
I would like to create/open the file in one EXE, then be able to access it from DCL or another EXE in the same procedure.
I have a general understanding of RMS internals, so answers with FAB or RAB structures will probably be understood. As a guess, SUPERVISOR mode is involved.
Asked and answered. :-).
Note 870.1 How do you open process permanent files and channels 1 of 5
QUARK::LIONEL "Ad Astra" 5 lines 1-JAN-1989 00:15
< PPFs only through CLIs >
--------------------------------------------------------------------------------
For question 1, the ONLY way to create a PPF is through a CLI such
as DCL. The usual method is the DCL OPEN command. From languages,
you can only open existing PPFs.
Nothing has changed since.
PPF are very restrictive ( minimal buffers, no global buffers, ...) and should be created BEFORE with DCL before a program tries to use it.
What problem are you really trying to solve?
Hein

Visusal Basic Script: Trying to obtain comments/description dll information

I have a question that pertains to scripting. For the sake of clarity I'll just start off with a bit of what I'm trying to do. We have a number of testing environments and projects going on in each environment that trying to keep track of what is where is becoming increasingly difficult.
In order to try and straighten this out I was going to create a script that would pull the comments/description (that is where our developers put the code branch,project name,and date of the build into. This is what we use for versioning) of the dll. Then I would dump this information into a simple table on an html page which would be pulled as a web part.
I was using VBS to perform this and I was able to successfully pull a version number and dump it into an HTML page. However, I have not been able to find any information on how to do this for the comments or description (using Server 2k3 and 2k8) fields.
So my question is if there is a way to pull this information using VBS, or would there be a better scripting language that would allow this to be done.
Thanks very much in advance.
I don't think exactly what you're asking for is possible, however this may be helpful:
http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/filesfolders/files/

How do I compile Oracle SQL scripts?

I have a series of SQL files, and I want to compile all of them. If do them manually by using benthic software, it takes a long time. I tried using TOAD, but I don't like to use cracked software. Can you help me execute a SQL file? I want to write a program to do some things for me.
From sql/plus I tried to create batch file but in some of my sql file developer used "/" and ";" so it caused sql/plus suddenly stopping the compilation. Please advise or recommend free software to help.
"I want apply the sql package , function and if they are invalid compile them again"
I am using oracle 10g.
Thanks
If you search for something like TOAD, try SQL Developer, a free tool from Oracle.
If you want to recompile existing source in your database, you can use dbms_utility.compile_schema.
If you try to install several files in a batch, SQL*Plus should work for you. Make sure that your files have the right format.
It sounds like you need to run a large sql script. Correct? Sql/Plus should work, but if you want a free IDE, I recommend SQL Developer. It isn't perfect, but it is one of the better free solutions.
"in some of my sql file developer used "/" and ";" "
You need to consistently use these to have any hope of using a tool to deploy. You don't want to have to use a GUI to deploy, so SQL*Plus is the standard to aim for. A good Oracle GUI should be able to run a SQL*Plus deployment script.
I generally start with SET DEFINE OFF otherwise unexpected ampersands (&) cause issues.
Do some basic grepping - any script with a CREATE PACKAGE, CREATE PROCEDURE, CREATE TRIGGER or CREATE TYPE (including CREATE OR REPLACE) should have a the "/" to execute that statement. If they don't, fix them.
For a first run though, I'd take them in batches of 10, until I was sure that they executed correctly. I wouldn't worry about compilation errors as long as they load. Afterwards, you can do a recompile of any invalid objects in the schema.
Then check USER_ERRORS to see what is still broken.

Convert vbscript snippets to vb.net

We have a bunch of vbscript snippets that are stored in a database. They are created by our users and are used during some complex calculations.
We are using the microsoft scriptcontrol to execute them. As we are switching to 64bit applications we cannot use the scriptcontrol anymore and therefore we are going to start using CodeDom and vb.net instead.
The problem is that we still need to support all those legacy vbscripts until they have been converted to vb.net scripts.
The scripts only contain simple functions taking arbitary number of parameters and do some caluclations on them. As I'm a C# developer I do not have that much experience with vbscript contra vb.net syntax.
Is it easy to convert vbscript code to vb.net (using regex or similar)? Got any pointers or things that I should think of? Or should I just wait until all scripts have been converted by the users (may take a while)?
If you have Option Explicit Off in VB.Net, quite a lot of vbscript code will be ok, but one problem you'd have is that in VB.Net you can't just execute a script by itself, so even if the code might work without any conversion you might not be able to run them in the same way since you'll need to compile them into executables before you can run them. If each script can be executed indepentenly of each other, then you'll either need to compile one executable per script, or have one master executable with a big Select Case in there to call the relevant code depending on command line parameters.
I'd suggest that it might be worth waiting for the users to convert them though and also keeping Option Explicit On and letting the users go through the scripts and add datatypes and similar, since it's quite possible that might find quite a few bugs in your scripts.