APEX email in external procedure
I'm going gray on this... What don't get me?
DECLARE
I have a procedure in this case called proc_name.
I have other tasks to recurring scheduler that runs under the same syntax that work very well and have for years;
I am running DB 11.2 and 4.2 APEX
BEGIN
I'm just trying to implement another Planner position to warn users in 60 days to a deadline.
I can confirm that the FOR LOOP in the procedure returns values.
I'm using the syntax is the following: I can't remember where he comes and also can't explain p_protocol or p_flow_id - but it works in other proceedings...
Proc_name (p_sgid = > VALID_SECURITY_ID p_protocol = > 'http://DB_SERVER_FQDN/pls/apex/', p_flow_id = > '200');
content of the procedure is:
p_sgid in NUMBERS
p_flow_id in VARCHAR2
values within the procedure:
wwv_flow_api.set_security_group_id (p_security_group_id = > p_sgid);
apex_application.g_flow_id: = p_flow_id;
The mail bit comes later...
20001 when I start work without exceptions I get ORA-: this procedure must be called from a session of the application.
This means for me that the security_id is not passed but does not explain why other procedures work fine. under the same user.
I hope that some of this means something to someone!
END;
Hi Samuistu,
Samuistu wrote:
I'm going gray on this... What don't get me?
The mail bit comes later...
20001 when I start work without exceptions I get ORA-: this procedure must be called from a session of the application.
This means for me that the security_id is not passed but does not explain why other procedures work fine. under the same user.
I hope that some of this means something to someone!
Yes. To call the APEX_MAIL package from outside the context of a request for Application Express, you must call APEX_UTIL. SET_SECURITY_GROUP_ID to set the context of APEX Session as follows:
PROCEDURE PRC_SEND_EMAIL ( P_PARAM1 IN VARCHAR2 ... , P_PARAM2 IN VARCHAR2 , P_APP_ID IN NUMBER ) AS -- variable declarations BEGIN -- set APEX session context FOR C1 IN ( SELECT WORKSPACE_ID FROM APEX_APPLICATIONS WHERE APPLICATION_ID = P_APP_ID ) LOOP APEX_UTIL.SET_SECURITY_GROUP_ID(P_SECURITY_GROUP_ID => C1.WORKSPACE_ID); END LOOP; -- mail sending code using APEX_MAIL END PRC_SEND_EMAIL;
NOTE: You can define constant G_APP_ID in your package and set it to your application number to use instead of P_APP_ID in the code above.
See the documentation for APEX_MAIL: https://docs.oracle.com/cd/E37097_01/doc.42/e35127/apex_mail.htm#AEAPI341
(See the first section of the 'Note')
Kind regards
Kiran
Tags: Database
Similar Questions
-
Apex.oraclecorp... I can send email from a procedure?
I have an application that wants to send automatic reminders...
I tried these but during the compilation of the procedure, it looks like they might not be available?
APEX_MAIL. SEND, UTL_MAIL.send, UTL_SMTP. Looks like they are disabled in this environment or...
What can I do with my privileges of the current user in apex.oraclecorp.com to send emails from a procedure?
Thank you!!!
Claudio
I found my problem...
The following procedure works fine... Thank you all!
create or replace procedure 'TRACKER_EMAIL '.
is
BEGIN
() apex_mail. Send
p_to => ' [email protected]',
P_FROM => ' [email protected]',
p_body-online "it is a test."
p_subj => "Recall!");
END;
-
Apex - with the external database audit trail
I'm currently installing a primitive audit trail that allows me to record data, create users, update, update user. I currently have 3/4 but I can not get the user name in the database like V ('APP_USER') is at the top and the database in Oracle 10 G elsewhere.
Suggestions or alternative ideas?
f1f7a787-7f56-4451-8300-5a9a0215226b
If v() and apex_application.g_user are not available in the trigger on the external database code.
But the external database package variables and procedures are available on the database running APEX.
What I would do, is to create a package with a package variable that will contain the user of the apex. (in the external database)
Then, in the application definition > session database > initialization code PL/SQL defined this package to the apex user variable.
Clear the package again variable in the cleanup code.
Using a package variable means that the value is aviable at the session of entire database but not outside the East.
Apex every page load or submit and load next page is a database session.
Now the package variable will be set when a user of the apex and the null value when there is a database user.
Using an nvl around the package with user variable as an alternative, will give you the user apex when the action was made by a user of the apex and the database user is not.
Nicolette
PS change your handle or at the signing of all least your post will result in a more friendly welcome message.
-
ORA-28575: could not open the RPC connection to external procedure
Hello
I get the following error:
ORA-28575: could not open the RPC connection to external procedure
ORA-06512: at "SDE". ST_GEOMETRY_SHAPELIB_PKG', line 1325
ORA-06512: at "SDE". ST_GEOM_UTIL', line823
my environment:
ORACLE 11 g 2 (11.2.0.3)
IBM AIX 6.1
ESRI software: ArcSDE 10.1 SP1
Since I'm on oracle 11g release 2, I used the method of the external procedure:
under $ORACLE_HOME/hs/admin
in the "extproc.ora" file, I added the line
SET EXTPROC_DLL = ANY
and still the same problem.
so I made the (listener and tnsnames configuration method) where that might solve the problem. However, it does not help...
I also applied the oracle metalink 1256784.1 ID DOC
but without success and I'm still getting this error (ORA-28575).
After extensive troubleshooting, I discovered that this will happen in one of two situations:
1. the external procedure library .so is corrupted.
OR
2. the external procedure library .so is a 32-bit... .to check that the Unix ( file lib.so), the exit command should give you 64-bit
-
Run task of the external procedure vbs
Hi all
I have a little vbs script that is designed to take some aspects of demand task from an application and write them to a folder specified in xml format and adding it to the server console and the task of the external procedure.
However, when the task runs, it always of errors with
Performance: "C:\Program Files (x 86) \VMware\Service Manager\Dev\TestXML.vbs.
System.ComponentModel.Win32Exception ERROR
Source: System
Message: The specified executable is not a valid Win32 application.I tried to force this option to use cscript.exe and wscript.exe system32 and syswow64, but when I put the command to
"' C:\Program Files (x 86) C:\Windows\SysWOW64\wscript.exe \VMware\Service Manager\Dev\TestXML.vbs"
I have another error
"System.ComponentModel.Win32Exception ERROR".
Source: System
"Message: the system cannot find the file specified."Does anyone have any ideas how I could get this race? I played with writing a short .bat to run cscript and the vbs but do not see how the vbs can then be passed to the query parameters if it is run in a batch file.
Any ideas would be massivey appreciated!
Just a raw idea.
What happens if... as command, you set just wscript.exe (or cscript.exe) and vbs file you specify as one of the settings in the task of external procedure (maybe a double quotes).
-
ORA-28575: could not open the RPC connection to the external procedure agent
Hello world
Could you please help me with this problem? I am trying to configure Oracle XE 11 g for external procedures, this because I need to access certain procedures in a DLL in Delphi 6.0, but even with the simplest of the dll that I do, as a sum in C, I can't pass this ORA-28575 error: could not open the RPC connection to the external procedure agent.
It's my listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(= Extproc PROGRAM)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(= Extproc PROGRAM)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC0))
(ADDRESS = (PROTOCOL = TCP)(HOST = myPC) (PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
and that's my tnsnames.ora:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myPC) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC0))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
Do you know what could be the problem? I'm out of ideas and google search...
Also, is there a difference in a call to a DLL in VB and one made in Delphi?
Thank you and best regards,See the MOS NOTES:
ORA-28575: cannot open connection to RPC if "ORA_EXTPROC_THREADED" is set in the registry [945396.1 ID]
External procedures - troubleshooting errors ORA-28575 [70638.1 ID] -
EXTERNAL PROCEDURE and the LISTENER. ORA
Hello
My environment:
+ Linux Red Hat 5.4 1 / 32 - Bit + company Oracle 10.2.0.4
+ 2 Linux Red Hat 5.4 / 64 - Bit + company Oracle 11.2.0.2
I tried to run an external Shell-Script with DBMS_SCHEDULER.*.
That's why I have to edit the file listerner.ora [http://download.oracle.com/docs/cd/E11882_01/network.112/e10836/advcfg.htm#i443234 url] Oracle Net Services configuration for external procedures:
The original listener.ora is:/u01/app/11.2.0.2/grid/network/admin>cat listener.ora #LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))) # line added by Agent LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))) # line added by Agent LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent LISTENER= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=stb)(PORT=1521)) (ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME=RAC) (ORACLE_HOME=/u01/app/oracle/OraHome_1) (SID_NAME=RAC1)) (SID_DESC= (SID_NAME=plsextproc) (ORACLE_HOME=/u01/app/oracle/OraHome_1) (PROGRAM=extproc))
I can run external shell scripts from sqlplus. But the friendship is broken! I can not start it!/u01/app/11.2.0.2/grid/network/admin>cat listener.ora.orig LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))) # line added by Agent LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))) # line added by Agent LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
With the listener.ora Moose I can start the listener.
What I did wrong? Please, help and
concerning
hqt200475hqt200475 wrote:
Hello
I can run external shell scripts from sqlplus. But the friendship is broken! I can not start it!
With the listener.ora Moose I can start the listener.
What I did wrong? Please, help andHello
This error message do you have?
also the edited listener is not complete, try below
LISTENER = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS=(PROTOCOL=tcp)(HOST=stb)(PORT=1521)) (ADDRESS=(PROTOCOL=ipc)(KEY=extproc)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME=RAC) (ORACLE_HOME=/u01/app/oracle/OraHome_1) (SID_NAME=RAC1) ) (SID_DESC = (SID_NAME=plsextproc) (ORACLE_HOME=/u01/app/oracle/OraHome_1) (PROGRAM=extproc) ) )
Hope this helps
See you soon
-
External procedure with Windows 'Handle' datatype
Hi all
I want to create an external procedure that use windows kerne32.dll library and GetFileSize function in the dll.
http://msdn.Microsoft.com/en-us/library/aa364955 (v = vs. 85) .aspx
as you can see in this link, GetFileSize has two parameters, the first is a HANDLE type, how can I assign this parameter? String does not work.
I always have the value zero, file exist and that its size is greater than zero.DWORD WINAPI GetFileSize( __in HANDLE hFile, __out_opt LPDWORD lpFileSizeHigh ); Create Or Replace Function GetSize (FileName Varchar2, P_Value in out pls_integer) Return binary_double As Language C Library Mylib Name "GetFileSize" parameters (FileName by reference String, P_Value int, return double ); / Declare X1 number ; X2 Pls_Integer; X Number; Begin x2 := 40000000; X1 := Getsize('C:\b.sql', X2); X := X1; dbms_output.put_line('x: ' ||x); End; /
what I am doing wrong?I don't know why you use kernel32.dll to know the file size. This can be done very easily using UTL_FILE.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options SQL> CREATE OR REPLACE FUNCTION utl_filesize(pi_dir_name IN VARCHAR2, 2 pi_file_name IN VARCHAR2) 3 RETURN NUMBER IS 4 file_size NUMBER; 5 blk_size BINARY_INTEGER; 6 fexists BOOLEAN; 7 BEGIN 8 UTL_FILE.fgetattr(pi_dir_name, 9 pi_file_name, 10 fexists, 11 file_size, 12 blk_size); 13 RETURN file_size; 14 END utl_filesize; 15 / Function created. SQL> SELECT utl_filesize('SAUBHIK','test2.csv') "Size in Bytes" FROM dual; Size in Bytes ------------- 61 SQL> SELECT utl_filesize('SAUBHIK','Winter.jpg') "Size in Bytes" FROM dual; Size in Bytes ------------- 105542 SQL>
Now coming to your actual question.
This is a demo, how to call PL/SQL.* kernel32.dll
By the way, I copied the file C:\WINDOWS\system32 kernel32.dll at C:\oracle\product\10.2.0\db_3\bin
My listener.ora configurationSID_LIST_LISTENEREXTPROC = (SID_LIST = (SID_DESC = (PROGRAM = extproc) (ENV = "EXTPROC_DLLS=ONLY:C:\oracle\product\10.2.0\db_3\bin\kernel32.dll") (SID_NAME = extproc) (ORACLE_HOME = C:\oracle\product\10.2.0\db_3) ) )
My tnsnames.ora configuration
EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )
A quick check.
LSNRCTL> stop LISTENEREXTPROC Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=extproc))) The command completed successfully LSNRCTL> start LISTENEREXTPROC Starting tnslsnr: please wait... TNSLSNR for 32-bit Windows: Version 10.2.0.3.0 - Production System parameter file is C:\oracle\product\10.2.0\db_3\network\admin\listener.o a Log messages written to C:\oracle\product\10.2.0\db_3\network\log\listenerextpr c.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\extprocipc )) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=extproc))) STATUS of the LISTENER ------------------------ Alias LISTENEREXTPROC Version TNSLSNR for 32-bit Windows: Version 10.2.0.3.0 - Prod ction Start Date 21-JAN-2011 17:32:26 Uptime 0 days 0 hr. 0 min. 3 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File C:\oracle\product\10.2.0\db_3\network\admin\listener. ra Listener Log File C:\oracle\product\10.2.0\db_3\network\log\listenerext roc.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\extprocipc))) Services Summary... Service "extproc" has 1 instance(s). Instance "extproc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully LSNRCTL> exit C:\Documents and Settings\Administrator>
C:\>tnsping EXTPROC_CONNECTION_DATA TNS Ping Utility for 32-bit Windows: Version 10.2.0.3.0 - Production on 21-JAN-2 011 21:53:10 Copyright (c) 1997, 2006, Oracle. All rights reserved. Used parameter files: C:\oracle\product\10.2.0\db_3\network\admin\sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1))) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO))) OK (70 msec) C:\>
Now, the codes.
SQL> CREATE OR REPLACE LIBRARY kernel32 AS 'C:\oracle\product\10.2.0\db_3\bin\kernel32.dll'; 2 / Library created. SQL> CREATE OR REPLACE FUNCTION CreateFile (FileName VARCHAR2 --1 2 ,p_DesiredAccess BINARY_INTEGER --2 3 ,p_ShareMode BINARY_INTEGER --3 4 ,p_SecurityAttributes BINARY_INTEGER --4 5 ,p_CreationDisposition BINARY_INTEGER --5 6 ,p_FlagsAndAttributes BINARY_INTEGER --6 7 ,p_TemplateFile BINARY_INTEGER )--7 8 Return BINARY_INTEGER 9 IS EXTERNAL 10 LIBRARY kernel32 Name "CreateFileA" 11 PARAMETERS (FileName STRING 12 ,p_DesiredAccess long 13 ,p_ShareMode long 14 ,p_SecurityAttributes long 15 ,p_CreationDisposition long 16 ,p_FlagsAndAttributes long 17 ,p_TemplateFile long 18 ,return long ); 19 / Function created. SQL> /* This is for closing the handle after use. */ SQL> CREATE OR REPLACE FUNCTION CloseFile (p_FileHandle BINARY_INTEGER) 2 Return BINARY_INTEGER 3 IS EXTERNAL 4 LIBRARY kernel32 Name "CloseHandle" 5 PARAMETERS (p_FileHandle long, return long); 6 / Function created. SQL> /* This is the main function for getting size */ SQL> CREATE OR REPLACE FUNCTION GetSize (p_FileHandle BINARY_INTEGER, 2 p_FileSizeHigh IN OUT BINARY_INTEGER) 3 RETURN BINARY_INTEGER 4 IS EXTERNAL 5 LIBRARY kernel32 NAME "GetFileSize" 6 PARAMETERS (p_FileHandle long, p_FileSizeHigh long, return long ); 7 / Function created. SQL> set serverout on SQL> DECLARE 2 v_FileSize BINARY_INTEGER; 3 v_FileSizeHigh PLS_INTEGER; 4 v_FileHandle BINARY_INTEGER; 5 v_filename VARCHAR2(500) :='C:\test2.csv'; 6 v_dummy BINARY_INTEGER; 7 BEGIN 8 v_FileSizeHigh := 400000000; 9 v_FileHandle:=CreateFile(v_filename -- File name 10 ,0 -- Type of access required (read/write ect) 11 ,0 -- disable share mode 12 ,0 --no securoty attribute 13 ,3 -- Means Open existing 14 ,128 --080h, File attribute normal. 15 ,0); --7 16 v_FileSize := Getsize(v_FileHandle, v_FileSizeHigh); 17 DBMS_OUTPUT.put_line('File Size in Bytes: ' ||v_FileSize); 18 v_dummy:=CloseFile(v_FileHandle); 19 END; 20 / File Size in Bytes: 61 PL/SQL procedure successfully completed. SQL> SQL> SQL> DECLARE 2 v_FileSize BINARY_INTEGER; 3 v_FileSizeHigh PLS_INTEGER; 4 v_FileHandle BINARY_INTEGER; 5 v_filename VARCHAR2(500) :='C:\Winter.jpg'; 6 v_dummy BINARY_INTEGER; 7 BEGIN 8 v_FileSizeHigh := 400000000; 9 v_FileHandle:=CreateFile(v_filename -- File name 10 ,0 -- Type of access required (read/write ect) 11 ,0 -- disable share mode 12 ,0 --no securoty attribute 13 ,3 -- Means Open existing 14 ,128 --080h, File attribute normal. 15 ,0); --7 16 v_FileSize := Getsize(v_FileHandle, v_FileSizeHigh); 17 DBMS_OUTPUT.put_line('File Size in Bytes: ' ||v_FileSize); 18 v_dummy:=CloseFile(v_FileHandle); 19 END; 20 / File Size in Bytes: 105542 PL/SQL procedure successfully completed. SQL>
Audit.
C:\>dir test2.csv Volume in drive C has no label. Volume Serial Number is 6806-ABBD Directory of C:\ 12/15/2010 01:35 PM 61 test2.csv 1 File(s) 61 bytes 0 Dir(s) 3,405,336,576 bytes free C:\>dir Winter.jpg Volume in drive C has no label. Volume Serial Number is 6806-ABBD Directory of C:\ 10/11/2010 05:27 PM 105,542 Winter.jpg 1 File(s) 105,542 bytes 0 Dir(s) 3,405,336,576 bytes free C:\>
-
Unable to create the external procedure Oracle to run host commands
Trying to follow this article
http://timarcher.com/node/9
His associates to
Oracle external procedure to run commands from the host
measures
(1) mkdir-p/u01/app/usfapp/oracle_external_procs/oracle_host
2)
Author suggests to create a filebut the header file is missing from the first line... may be not not sure... it's < stdio.h >
create a file named oracle_host.c. The contents of this file will be:
#include
int RunCmd(char *cmd)
{
(System (cmd)) return;
}
(4) create the file called makefile. The contents of this file will be:
ORACLE_HOST: oracle_host.o
GCC-shared o oracle_host.so oracle_host.o
$ cat makefile
ORACLE_HOST: oracle_host.o
GCC-shared o oracle_host.so oracle_host.o
5)
Now, run the make command
The output on my server looks like:
[u01/app/usfapp/oracle_external_procs/oracle_host]
Banner@usfbannerte [TRNG] > make
GCC-shared o oracle_host.so oracle_host.o
here, I stuck... [Not able to run this step
] $ make
GCC-shared o oracle_host.so oracle_host.o
/ usr/bin/LD: oracle_host.o: relocation R_X86_64_32 against 'a local symbol' can not be used when an object shared; Recompile with - fPIC
ORACLE_HOST.o: could not read symbols: bad value
collect2: ld returned 1 exit status
make: * [oracle_host] error 1
One has an idea of what went wrong
Other links related to this is more welcomed.
Please suggest...http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:934029542973
-
How to extract data from the APEX report with stored procedure?
Hi all
I am doing a report at the APEX. the user selects two dates and click on the GO button - I have a stored procedure linked to this region of outcome for the stored procedure is called.
my stored procedure does the following-
using dates specified (IN) I do question and put data in a table (this painting was created only for this report).
I want to show all the data that I entered in the table on my APEX report the same procedure call. can I use Ref cursor return? How to do this?
Currently, I use another button in the APEX that basically retrieves all the data from table. Basically, the user clicks a button to generate the report and then another button for the report. which is not desirable at all :(
I m using APEX 3.1.2.00.02 and Oracle 10 database.
pls let me know if you need more clarification of the problem. Thanks in advance.
Kind regards
Probashi
Published by: porobashi on May 19, 2009 14:53APEX to base a report out of a function that returns the sql code... Your current code goes against a Ref cursor returns the values...
See this thread regarding taking a ref cursor and wrapping it in a function to channel out as a 'table' (use a cast to cast tabular function vale)...
(VERY COOL STUFF HERE!)
Re: Tyring to dynamically create the SQL statement for a calendar of SQL
Thank you
Tony Miller
Webster, TX -
Professional Hello, etc. of users experienced Apex.
I am currently using the oracle database schema cloud service, which is related to my extension service java saas.
I have a requirement to send reports to certain accounts of e-mail per day. Hence the need to use the CLOUD_SCHEDULER API, APEX_EMAIL API and a custom "Get_REPORT"... return blob function to convert the sql result set to CSV file to be attached to e-mails.
1 function GET_REPORT returns the BLOB as the query results set CSV file. Autonomous œuvres
2. I created the 'SENDEMAIL' procedure that accepts the responsibility of the sender and receivers email address, subject and a BLOB (GET_REPORT) to be attached to the email. And sends APEX_MAIL. PUSH_QUEUE. : This method works stand-alone.
3. I created the "ScheduleCSVToEMAIL" procedure that accepts the e-mail to, from, cc, tablefiltertext, tablename: this procedure combines 1 and 2 as below...
SQL_TEXT := 'SELECT * FROM '||TABLE_NAME||' WHERE ' || SQL_FILTER ||''; REPORT := GET_REPORT(SQL_TEXT); SENDENDVI_MAIL2(TO_ADDR,COMMA_CC, FROM_ADDR, EM_TITLE,EM_TITLE,null,null,REPORT,null);
above works fine when run standalone.
4. I created CLOUD_SCHEDULER PROGRAMS as below
BEGIN CLOUD_SCHEDULER.CREATE_PROGRAM( program_name => 'emailtest1', program_action => 'SENDENDVI_MAIL3', program_type => 'STORED_PROCEDURE', number_of_arguments=>10, enabled =>false ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>1, argument_type=>'VARCHAR2', DEFAULT_VALUE=>'[email protected]' ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>2, argument_type=>'VARCHAR2', DEFAULT_VALUE=>'[email protected]' ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>3, argument_type=>'VARCHAR2', DEFAULT_VALUE=>'[email protected]' ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>4, argument_type=>'VARCHAR2', DEFAULT_VALUE=>SYSDATE||'_ENDVI_VH_INSURANCE' ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>5, argument_type=>'VARCHAR2', DEFAULT_VALUE=>null ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>6, argument_type=>'VARCHAR2', DEFAULT_VALUE=>null ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>7, argument_type=>'VARCHAR2', DEFAULT_VALUE=>null ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>8, argument_type=>'VARCHAR2', DEFAULT_VALUE=>null ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>9, argument_type=>'VARCHAR2', DEFAULT_VALUE=>'G_EMAIL_VH_INSURANCE_INFO' ); CLOUD_SCHEDULER.DEFINE_PROGRAM_ARGUMENT( program_name => 'emailtest1', argument_position=>10, argument_type=>'VARCHAR2', DEFAULT_VALUE=>null ); CLOUD_SCHEDULER.ENABLE('emailtest1'); END;
and
BEGIN CLOUD_SCHEDULER.CREATE_JOB('emailtestrun1', program_name=>'emailtest1'); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',1,'[email protected]'); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',2,'[email protected]'); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',3,'[email protected]'); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',4,SYSTIMESTAMP||'_ENDVI_VH_INSURANCE'); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',5,SYSTIMESTAMP||'_ENDVI_VH_INSURANCE'); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',6,NULL); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',7,NULL); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',8,NULL); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',9,'G_EMAIL_VH_INSURANCE_INFO'); CLOUD_SCHEDULER.SET_JOB_ARGUMENT_VALUE('emailtestrun1',10,NULL); CLOUD_SCHEDULER.ENABLE('emailtestrun1'); END;
Above, executed but it obviously it didn't, I asked the table "USER_SCHEDULER_JOB_RUN_DETAILS" and I got the reason of failure below.
ORA-20001: This procedure must be invoked from within an application session. ORA-06512: at "APEX_040200.WWV_FLOW_MAIL", line 339 ORA-06512: at "APEX_040200.WWV_FLOW_MAIL_API", line 97 ORA-06512: at "F1ZKNWJD2RE1.SENDENDVI_MAIL3",line 56
Please help what I do to get my work requirement.
Note: I already tried to use the Scheduler in the format below, who gave the same result
BEGIN CLOUD_SCHEDULER.create_job ( job_name => 'ENDVI_AUT_EM_ROCKET', job_type => 'PLSQL_BLOCK', job_action => 'BEGIN SCHEDULE_CSV_EMAIL(''G_EMAIL_VHROCKETDETAILS'',''[email protected]'',''[email protected]'',''[email protected],[email protected]'',NULL,SYSTIMESTAMP||''_TEST SCHEDULE_CSV_EMAIL'',NULL,NULL,NULL); END;', repeat_interval => 'FREQ=MINUTELY; INTERVAL=3;', enabled => TRUE); CLOUD_SCHEDULER.set_attribute ( name => 'ENDVI_AUT_EM_VH_INSURANCE', attribute => 'max_runs', value => 20); CLOUD_SCHEDULER.enable(name => 'ENDVI_AUT_EM_VH_INSURANCE'); END
Right answer
Hi oladslw,
You must perform an additional step before calling the API APEX_MAIL outside an Application Express application. Two ways to achieve this are described in the APEX_MAIL documentation (see first Note) and in the APEX_UTIL documentation. Another way is:
for c1 in ( select workspace_id from apex_workspace_schemas where workspace_name = sys_context( 'userenv', 'current_schema' ) and rownum = 1 ) loop apex_util.set_security_group_id( p_security_group_id => c1.workspace_id ); end loop;
The code above retrieves your workspace_id of the dictionary of the current schema-based APEX of (your), then sets the security context of APEX. After that, you will be able to call APEX_MAIL in a same database session.
Thank you
Vlad
-
How to ACCEPT values on page APEX sent by external APEX through POSTmethod
Hi people,
How can I accept the values in my page APEX which are send to my page through the POST method from outside of my application?
Sample test:
Of non-apex application (simple html page), I would like to post 2 fields (field "Par1" and the field "Par2") in my APEX page. On my apex page I defined the areas P102_PAR1, P102_PAR2.
How can I define action URL in top shape, so once you press the "SUBMIT" button it will fill both fields in my apex page?<html> <HEAD> <TITLE>Tester</TITLE> </HEAD> <body> <h1>Test to POST form values into APEX page</h1> <form action="[my_url???]" method="POST"> <table> <tr> <td>Par1</td> <td> <select name="Par1"> <option value="OPTION1">Option 1</option> <option value="OPTION2">Option 2</option> <option value="OPTION3">Option 3</option> </select> </td> </tr> <tr> <td><label for="Par2">Par2</label></td> <td><input type="TEXT" name="Par2" id="Par2" size="30" value="123"></td> </tr> </table> <input type="SUBMIT" value="send"> </form> </body> </html>
My APEX (p102) page is a blank page, with only 2 fields P102_PAR1, P102_PAR2 text at the moment.
Thank you very much
Tomas
===========
If I put above url to: ' http://cit-dev-as5:7780 / pls/he/f? p = 700:102:1659258057907233' (stright to my page & session sharing) and press "SUBMIT" button, then I recive below error message:f: SIGNATURE (parameter names) MISMATCH VARIABLES IN FORM NOT IN PROCEDURE: PAR1,PAR2 NON-DEFAULT VARIABLES IN PROCEDURE NOT IN FORM: DAD name: he PROCEDURE : f URL : http://cit-dev-as5:7780/pls/he/f?p=700:102:1659258057907233 PARAMETERS : =========== P: 700:102:1659258057907233 PAR1: OPTION1 PAR2: 123
Tomas:
Treat the input of an external application that needs to be passed to an APEX application is to create a procedure from pl/sql intermediary who will receive the input of the external source and then format this entry as required by the syntax of the URL of the APEX and then re - direct the user to this URL APEX format.
Using the example you provided you have the pl/sql procedure as followsCreate or replace procedure extinput(par1 in varchar2,par2 in varchar2) is l_apex_url varchar2(4000; begin l_apex__url:= 'http://myhost:myport/apex/f?p=700:102::::P_102_PAR1,P_102_PAR2:' || par1 ||','||par2; owa_util.redirect_url(l_apex_url); end;
The names of parameters in your procedure must match the names of the fields of the POST.
CITY
-
Transfer emails on external hard drive
I'm trying to figure out how to get all my emails on my WD external hard drive & also to have all my folders & favorites on it also. Can't seem to understand how it's done. I made my photos, documents & downloads very well. Any suggestion would be appreciated.
Thank you
Tammy
Tammy
What is MSN, or Hotmail/Outlook.com? If outlook.com or Hotmail
If you want to save your data, you must set up your account on a mail Client. Follow the steps below to do this:Download Windows Essentials, it comes with Outlook Connector pack, Microsoft SkyDrive, Windows Live Mail, parental controls, writer. When you download Essentials, you can choose only to custom install to install Windows Live Mail according to your preferences.Once Windows Live Mail is installed and configured, just log in to your account and wait for the program to download your emails. When you have finished uploading, you should have an exact copy on your hard drive.For more information on setting up your account -
Is it possible to copy a part of a page from the APEX with a public procedure of APEX stored?
The element is a grid view control and it ist does not part of each page.
I copy the element of grid view several times. After that, I have to change a lot of settings in the copied grid views. Normally, I do this the APEX constructor GUID clicking over and clicking on...
I would copy the perspective grid in a more comfortable way (means without clicking) in a stored procedure by calling procedures PL/SQL to the APEX (such as the GUID of the APEX Builder).
There are all the public stored procedures to do?It would be preferable to this post in the forum of the APEX on OTN
Steve -
DBMS_SCHEDULER and email
I'm a bit confused with the Scheduler and e-mail.
I have a procedure that sends an email, just a simple for testing purposes. This procedure runs and works great.
I can set up a schedule to perform the above procedure, and it fails. I know the controller works because I can change the code of procedure for (for example), update a field in a table and it is successful.
I think that my problem lies in the attributes EMAIL_SERVER and EMAIL_SENDER of the Scheduler.
I do not understand how to send email with the success of the procedure and window SQL or a page of the APEX, but he cannot leave envisaged.
Also, I'm not sure what the effect is if I set the Scheduler attributes (EMAIL_SERVER and EMAIL_SENDER). This will affect only the emails sent by the Scheduler? (that is to say, I will break anything)
Oracle 11.2
Request Express 4.2.6.00.03
I'm not dba. I am owner of the workspace.
Thank you
NT
Hi Sir Neils
I hope that this thread has solved your problem
APEX email in external procedure
Concerning
Mahmoud
Maybe you are looking for
-
DeskJet F2180 + Vista 64-bit
Hello I am currently in the situation that I need to print something, in the case of witch, I decided to use a HP Deskjet F2180 I had laying around. I use Windows Vista Ultimate 64-bit so I thought I was good off to download this file. Appearently th
-
Hello H NIDMM 3.0.6 installation but I couldn't find examples in there. I have woul dsincerely grateful if you can help me to find the examples for the DMM OR C. Thank you -Sulva
-
automatically be disconnected?
Whenever my computer is not used for a few minutes, it automatically disconnects me and I have to open a session back with my password how can I get rid of this problem? Also, I don't want to use a password every time how these problems?
-
Windows meadia player and other programs of media player unable to burn CDs?
Hi, ive never had this problem before, and I have no idea how belonged there. Ive done what seems serches 1 million on the subject without answers anywhere... I am unable to burn CDs, either windows media, real player, quick time player player or my
-
Windows 7 does not check for updates
I have windows 7 I installed Windows 10 but didn't like it then restored to Windows 7, but since she doesn't check or install updates to laptop... Help, please