I have an Oracle Apex 5 application I created. It is working perfectly with my backend perl adapter I wrote but I need to make a change with the insert into portion, which is currently being run from the backend script. I need to get apex to do the insert for me. The problem is that some of the variables I need to insert into the DB is not available within Apex as the perl script will get these variables hence why I originally got the perl script to do the insert.
So to explain what I mean. I would pass IP address and SNMP community from Apex to the script. The script will run an SNMP get command with the IP and community and get back the Sysname OID which contains the Hostname of the device. Apex does not know this hostname and therefore I need to find a way to send this back to Apex so I can do the insert. One way is to do a temp DB table with the device name for instance and right from there, but that is not ideal.
So I have a form that someone will fill in all the detail. when they submit the form, the button runs the following process.
DECLARE
myipaddress VARCHAR2(50);
username VARCHAR2(50);
mydevicename VARCHAR2(50);
mycommstring VARCHAR2(50);
mydomain VARCHAR2(50);
sys_owner VARCHAR2(200);
platform VARCHAR2(200);
subservice VARCHAR2(200);
domain VARCHAR2(200);
state VARCHAR2(200);
department VARCHAR2(200);
location VARCHAR2(200);
city VARCHAR2(200);
region VARCHAR2(200);
country VARCHAR2(200);
sub_cont VARCHAR2(200);
continent VARCHAR2(200);
mykeyvalue VARCHAR2(50);
mycreate VARCHAR(200);
mytask VARCHAR2(200);
tmpvar VARCHAR2(30);
sleep VARCHAR2(200);
actual VARCHAR2(200);
BEGIN
actual := 'Discover';
username := :P43_USERNAME;
myipaddress := :P43_IP_ADDRESS;
mycommstring := :P43_SNMP_COMMUNITY;
sys_owner := :P43_OWNER;
platform := :P43_PLATFORM;
subservice := :P43_SUBSERV;
domain := :P43_DOMAIN;
state := :P43_MON_STATE;
department := :P43_DEPARTMENT;
location := :P43_LOCATION;
city := :P43_CITY;
region := :P43_REGION;
country := :P43_COUNTRY;
sub_cont := :P43_SUB_CONTINENT;
continent := :P43_CONTINENT;
mycreate := SYSDATE;
select TO_CHAR(SYSDATE,'YYYYMMDDHHMISS') into mykeyid from dual;
mytask := 'Verify';
VERIFY(username, myipaddress, mycommstring, sys_owner, platform, subservice, domain, state, department, location, city, region, country, sub_cont, continent, mycreate, actual);
dbms_lock.sleep( 10 );
END;
The VERIFY
section sends all the form detail to the external script which does some checks etc. Gets other items like Serial Number, Device Name etc. which needs to be inserted into a Table. So the insert from the perl script has alot more than just IP, Service etc as per the form.
Any help will be great, I just need a simple way to get some variables to be passed back to Apex from the External command. Thanks in advance!
PS!! Please do not judge all my declarations etc, this is a test PL/SQL procedure which I use to add and remove things until I am happy with my app :)
So I am sorted out. I read a whole lot around dbms_output and managed to trap my external values from there.