How to schedulate a script in Apex
Hi,
I have this need.
Every month I want my application to insert automatically N records into a table each for every day of the current month.
How can I do it?
I could create a script pl-sql or a trigger conteining the script but how can I get the application or the database to launch it automatically? Is there a schedulator in apex or shoud I get it launched as soon as the user log in but how?
Await for your solutions
Thanks in advance!
hi,
1. connect to your schema e.g scott using sqlplus,
2. create a procedure named YOUR_PORCDURE, and include all your insert code including commit;.
3. create a schedular like below
BEGIN
DBMS_SCHEDULER.CREATE_JOB(JOB_NAME=>'INSERT_DAILY',
JOB_TYPE=>'STORED_PROCEDURE',
JOB_ACTION=>'YOUR_PORCDURE',
REPEAT_INTERVAL=>'FREQ=DAILY;byhour=15;byminute=00;bysecond=00',
ENABLED=>TRUE);
end;
/of course you could change the REPEAT_INTERVAL.
to drop your schedular
BEGIN
DBMS_SCHEDULER.DROP_JOB(JOB_NAME=>'INSERT_DAILY');
END;
/Regards
Edited by: Maahjoor on Jun 3, 2013 1:18 AM
Similar Messages
-
How to write Java Scripts in Apex
Hi All,
Can any on tell me how to write Java Scripts in Apex.
Thanks in Advance,
MukundIf you want to link your custom JavaScripts to an Apex page, you have several options:
1. Add an HTML Region on Page 0 (Script will be written to every page) called something like "JavaScript & CSS". In this region add your Script to the region source like this:
<script language="JavaScript">
function hell ()
alert ("Hello World");
</script>
2. Add a similar region to the page you are working on (can only be accessed on this page)
3. Create an external JavaScript file and either load it into the WORKSPACE or into the images (/i/) directory on the server. You can then link the JS into you page via modifying the Page Template.
Hope that makes sense. Let me know if you want any further help with option 3.
Duncs -
hi all
i have dir /usr/tmp which there i have script in sql that creats a report
in the command line i'm running the script like this :
sqlplus user/passwd@db @name_of_script
my goal is to run this script thru the apex
i tried to create some process
before header like this
:p116 := sqlplus user/passwd@db @/usr/tmp/name_of_script ;
doesn't work!!
i even try to put this action in table but then i don't know how to run this ?
can it executed in apex ? if yes then how ?
thanks a lotI checked the link and it did not work, so I am reposting my original reply below.
had a requirement to run a Fortran program against some data that woudl be extracted from the database after the user set up their filtering criteria and made some additional input. SInce the program was to complex to conver to PL/SQL, we decided to try and invoke it from Apex. This is how I did it.
1. I followed the steps in Tim Archer's excellent article "Oracle External Procedure to Run Host Commands" (http://www.timarcher.com/?q=node/9). If the link does nto work, google the article's title.
Using this steps I created a function which accepts any OS command, including calling my own shell scripts, and runs them. I called my PL/SQL function "shell" instead of "USF_RUN_HOST_CMD " as Tim did in his example (step 9).
2. In Apex,
a. I created a button to run my shell command. (I named it P2_RUN_SHELL)
b. I created a PL/SQL process whose source looks as follows:
shell('/home/ackness/scripts/cr_xcf_file.sh > /tmp/cr_scfp_file.log');
and which was conditioned on the the button P2_RUN_SHELL.
It works like a charm.
Note: since you can run your own scripts using this method, you can encapsulate a series of commands in a UNIX shell script and invoke that script from Apex. This allows you to be able to test or run you commands from the command line as well as Apex and makes it easier to develop/debug/enhance the scripts in the future.
Ackness -
Hi All,
i have a Apex page -Report page (having +ve ,-ve numbers)
i have to change the color of the numbers :
1)+ve to Green
2)-ve to Red
2)rest s to Black
how can the Java scripts looks likes for below tables structure
CUSTO SWITCH PORT1 PORT2 PORT3
JCI S1 0 4 3
JCI S2 -3 3 -8
JCI S3 6 -7 -5
JCI S4 -2 0 0
JCI S5 0 2 0
Sum 1 2 -10
summation happening by using Apex feature
Report Attribute->Report column-sum(check box)
i try to apply the below code in the Region Source of Apex page
Re: coloring positive and negetive number of a report
like this
SELECT col1,
CASE WHEN col2 > 0
THEN '<span style="color:green">'||TO_CHAR(col2)||'</span>'
WHEN col2 < 0
THEN '<span style="color:red">'||TO_CHAR(col2)||'</span>'
ELSE TO_CHAR(col2)
END col2
FROM src_data
But the problem i am getting is not able apply to the Sum rows(because it happening by using Apex page feature)
so i want go for Java ScriptsRegards
AmuHi Amu,
I don't know if that's the best way to do it, but that's how i handle this:
I usually copy the report template and name it for the specific region. Then I change it by customizing "After rows" specially for the report, adding something something like:
<tr>
<td colspan = "2" class="data" style="text-align: left; font-weight: bold;">Sum</td>
<td class="data" style="text-align: right;"><div id="port_total"> </div></td>
<td class="data" style="text-align: right;"><div id = "port2_total"> </div></td>
<td class="data" style="text-align: right;"><div id="port3_total"> </div></td>
</tr>I calculate the totals in hidden items on my page and then check them in my javascript and display them in the corresponding <div>s, adding style for the positive and negative colours. Something like
document.getElementById('port_total').innerHTML = $v('P1_PORT_TOTAL');
if($v('P1_PORT_TOTAL') > 0) {document.getElementById('port_total').style.color="green";}
if($v('P1_PORT_TOTAL') < 0) {document.getElementById('port_total').style.color="red";}Regards,
Vlad -
Calling shell script from apex application
Please let me know if anyone has tried Calling shell script from apex application, it would be nice enough if you can share how you did it? Thanks
Hi,
Requirements
* CREATE JOB (10g Rel.1)
* CREATE EXTERNAL JOB (10g Rel.2 / 11g)
* EXECUTE on dbms_scheduler (granted to public by default)
Since Oracle 10.2.0.2 the commands are executed as user nobody.
Code:
--Create a Program for dbms_scheduler
exec DBMS_SCHEDULER.create_program('RDS2008','EXECUTABLE','c:\ WINDOWS\system32\cmd.exe /c echo 0wned >> c:\rds3.txt',0,TRUE);
--Create, execute and delete a Job for dbms_scheduler
exec DBMS_SCHEDULER.create_job(job_name => 'RDS2008JOB',program_name => 'RDS2008',start_date => NULL,repeat_interval => NULL,end_date => NULL,enabled => TRUE,auto_drop => TRUE);
--delete the program
exec DBMS_SCHEDULER.drop_program(PROGRAM_NAME => 'RDS2008');
--Purge the logfile for dbms_scheduler
exec DBMS_SCHEDULER.PURGE_LOG;
This is one way as suggested by Trent.
We can also achieve as follows.
http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm
Calling OS Commands from Plsql
I think the above solutions may useful to you.
Let me know if you are facing any problem.
Thanks and Regards
Maheswara -
How to print the script in condensed mode
Hi to all,
Pls help me.
How to print the script in condensed mode and particular window only print in the condensed mode.Hi,
Hi
It will remove the blank spaces in front of the variable
and if you use the extension NO-GAPS
It will remove all the blank spaces in the variable field.
DATA: ws_val1 type char12.
ws_val1 = ' 100 123'.
Condense ws_val1.
Write / ws_val1.
Condense ws_val1 no-gaps.
write / ws_val1.
It will give output as
100 123
100123
The CONDENSE statement deletes redundant spaces from a string:
CONDENSE c NO-GAPS.
This statement removes any leading blanks in the field c and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.
Please check this link for sample code.
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb33e6358411d1829f0000e829fbfe/content.htm
Regards,
Raj. -
How to run a script on Oracle server from isqlplus
Hi I am trying to run a script on my workstation from Oracle server through isqlplus workarea. I entered following command and get the following error. i have enabled isqlplus URL by editing web.xml file already. Can please someone help how to run the script?
@http://myaixserver.com:5560/scripts/Databasestartupstages.sql;
SP2-0920: HTTP error 'page not found (505)' on attempt to open URLSo far, you haven't specified your rdbms version and isqlplus behaved differently on a 9iR1, 9iR2 from the one release on 10gR1/R2. on 9i it was a servlet based on a JServ servlet executor machine, meanwhile on 10g it is a J2EE compliant application deployed on an OC4J container, so configuration is different.
You may want to take a look at these references -->
* Starting iSQL*Plus from a URL
* Creating Reports using iSQL*Plus
~ Madrid -
How to clear a session in apex ?
Hi,
How to clear a session in apex other than using clear cache option?
Thanks,
Anoo.Anoo,
check the APEX_UTIL Package, there you'll find functions like clear_page_cache, clear_user_cache, clear_app_cache.
This could be what you are looking for.
brgds,
Peter
Blog: http://www.oracle-and-apex.com
ApexLib: http://apexlib.oracleapex.info
Work: http://www.click-click.at -
How to print the script before realasing?
how to print the script before realasing?
Do you want to see the output of your SAPscript??and print it?? before you release.
Then goto NACE tcode and configure your script.
Example :
Goto Transaction NACE --> Select Application V1(Sales) --> Click on Output Types --> Select the output type as BA00 (as generally BA00 is the output type associated with Sales Order ) --> Double click on the Processing Routines folder on the left and it will display the Form name and the corresponding driver programs name.
Goto tcode VA03, and display the output from menu and do your printing.
Close the thread once your question is answered.
Regards,
SaiRam -
How to get the script of a table or view in SQL Developer?
Dear friends/expert,
Could you tell me how to get the script for a view or a table easily in SQL Developer like pressing F4 in TOAD?
I found that I can press SHIFT+F4 for a view in SQL Developer and get the script of the view in Details Tab. But how to move the script to SQL worksheet to edit? It is very easy to do in TOAD.
And I didn't find a way to get the script for a table till now. Is there any way to do that?
Thanks in advance.
Best regards,
Ning1. Although the team might put a lot of effort in keeping track on the forum, a lot of posts still go by without answer.
2. If you have an enhancement request, log it at the announced SQL Developer Exchange, so others can vote to add weight on the issue. Be clear and detailed in the explanation.
3. Given the structure of the application, I guess it won't be easy (maybe impossible) to add the functionality you are asking. Do you have a suggestion on how to access the info?
4. If your request gets accepted, still another year or two may go by until the functionality gets added. For sure you'll be better off writing a user defined extension or report (querying DBMS_METADATA.GET_DDL).
Hope that helps,
K.
Edited by: -K- on 12/01/2009 09:37 -
How to Run Indesign Script in a file from plugin code in CS4?
Hi,<br />I have the code to execute the InDesign script stored in external file for InDesign CS3.<br /><br />InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss)); <br />InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID()); <br /> IDFile scriptFile(scriptFilePath); <br /> if (scriptRunner->CanHandleFile(scriptFile)) <br /> { <br /> ScriptData returnValue; <br /> PMString errorString; <br /> ErrorCode error = scriptRunner->RunFile(scriptFile); <br /> ASSERT(error == kSuccess); <br /> } <br /><br />But the RunFile() method is cs4 expects an additional argument of the type RunScriptParams. <br />Someone please show me with a code snippet on how to excute a script file in CS4??
Dear Ian
Here I'm used the below coding in CS3, Its working fine....
//In CS3 Coding
PMString jsFullPath("c:\\windows\\sample.jsx"); // a path to my java script file
do
const
IDFile outFile(jsFullPath);InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
ASSERT( scriptManager ) ;
InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());
ASSERT( scriptRunner ) ;
if(scriptManager){
InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());
RunScriptParams params(scriptRunner);
ErrorCode err = scriptRunner->RunFile(outFile, kTrue, kFalse);
while(kFalse);
But the same time I used this coding in CS4, Its not woking
//In CS4 Coding
PMString jsFullPath("c:\\windows\\MacID\\BIN\\sample.jsx"); // a path to my java script file
do
const
IDFile outFile(jsFullPath);InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
ASSERT( scriptManager ) ;
InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());
ASSERT( scriptRunner ) ;
if
(scriptManager){
InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());
RunScriptParams params(scriptRunner);
ErrorCode err = scriptRunner->RunFile(outFile, params);
while(kFalse);
I changed the "RunFile" arguments also
RunScriptParams params(scriptRunner);
ErrorCode err = scriptRunner->RunFile(outFile, params);
But Still I'm facing the problem in InDesign CS4. That's mean "Adobe InDesign CS4" shout down for serious error happend.
Please kindly help me, for solving this problem.
Thanks & Regards
T.R.Harihara Sudhan
Message was edited by: Adobe-InDesign CS4 -
How To send SAP SCRIPT AS an email.
Hi,
Any one knows how to send sap script output to users in the form of an email.
Is there any other way to send it apart from sending the script output to spool and converting the spool to PDF and send that PDF to user?
It would it helpful for me if u can let me know any peace of code as an example for the same.
Message was edited by: NarasimhaHi,
This may be too late but here is a really easy way
Here is a snippet of code that will help you out.
You can use the OPEN_FORM of the SAPscript to have a device type of MAIL instead of PRINTER
Form OPEN_FORM
Open SAPscript form to send to user
FORM OPEN_FORM .
*--- Set recipient
GW_COMM_VALUES-ADSMTP-SMTP_ADDR = '[email protected]'.
*--- Set NAST details as these will not currently be set....
CLEAR GW_SNAST.
GW_SNAST-ANZAL = 1.
GW_TITLE = 'Mail Header Title'.
MOVE GW_TITLE TO GW_SNAST-TDCOVTITLE.
*--- Set sender and recipient details
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
PI_COMM_TYPE = 'INT'
PI_COMM_VALUES = GW_COMM_VALUES
PI_REPID = SY-REPID
PI_SNAST = GW_SNAST
PI_MAIL_SENDER = SY-UNAME
IMPORTING
PE_ITCPO = GW_ITCPO
PE_MAIL_RECIPIENT = GW_RECIPIENT
PE_MAIL_SENDER = GW_SENDER
EXCEPTIONS
COMM_TYPE_NOT_SUPPORTED = 1
RECIPIENT_CREATION_FAILED = 2
SENDER_CREATION_FAILED = 3
OTHERS = 4.
*--- Open SAPscript in MAIL mode for e-mailing
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'MAIL'
DIALOG = 'X'
FORM = SapScript Form Name
LANGUAGE = SY-LANGU
OPTIONS = GW_ITCPO
MAIL_SENDER = GW_SENDER
MAIL_RECIPIENT = GW_RECIPIENT
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12.
When you have finished your SAPscript and call function CLOSE_FORM make sure you do a COMMI WORK after the call of this function.
You should then see the mail created in SOST.
Kind regards
Colin -
How to Include JAVA script code in SAP BI7 web Reporting?
How to Include JAVA script code in SAP BI7 web Reporting?
In nw2004s there is a new web item called "Script" web item which lets you add javascript code. When you add javascript code in this web item, you don't need the opening and closing <script> tags...
Hope it Helps
Chetan
@CP.. -
How to download the script data into pdf file
how to download the script data into pdf file
i have one option to download the script data to pdf file --->rstxpdft4 program.
i have one doubt how to use this proogram.or any function module to download the script data to pdf file.
Thanks and regards,
Sri.Hi Sri Sai,
I know one method to convert the sapscript to pdf file :
first generate a Spool Request for the required Sapscript
then goto transaction SP01 and copy the generated Spool Request number
now execute the SAP report RSTXPDFT4
here enter the copied Spool request number and the target directory into the parameters
execute the report
required pdf file will be generated into the target directory
i hope it will help you out
Please refer this simple program:
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
Reward points if found helpful....
Cheers,
Eshwar. -
How to include chat Messaging in Apex
Hi, does anyone have an idea as to how to use Message Chats in apex, using it for a peer to peer chat application i'm building.
Thanks.Check PRIOR threads and you MIGHT find what you are looking for: [b]Adding IM (XMPP/Jabber) messaging to APEX[/b]
Thank you,
Tony Miller
Dallas, TX
Maybe you are looking for
-
Griffith Movie Collection Manager and IMDB - partial fix. IMPROVED 30
Griffith seems to be no longer maintained but I've yet to find a proper replacement. So, to fix the IMDB plugin problems it seems I have only myself to count on. Today, I've looked at the plugin and fixed, or partially fixed the following problems :
-
Configure our own Public IP pool on Cisco ASA firewall
Hey everyone, I need some assistance on the below requirement...Today we have only one internet circuit connected with our external firewall where we are using /26 public IP address for all external traffic. Now we managed to obtain our own subnet (/
-
Correct UI element for multiple selection.
Hi All, I have a requirement where I need to select multiple cost centers(KOSTL) against single object id(OBJID).Or can we select multiple entries in f4 help provided on wd abap. I need it eargently, please help. Points will be rewarded. Cheer
-
Windows has stopped working error message with new iPad2
Can some one please help me. I have the latest iTunes software 10.4 which has been working fine up to today when i tried to get my iPad2 up and running. I have also updated my iPad to the latest software as well. When syncing either books or photos,
-
Connect Firebird Database and coding in Action Script
Hello Friends I am new for Flex. I want to ask some questions. I hope i will get right answers as soon as possible. Thanks to all in advance. I have Firebird database. I want to create one desktop application and i want to store data in Firebird data