Determine an procedure's/function's last execution timestamp?
Hi,
Is it possible to get the last timestamp (absolute date and time) of an procedure's/function's (in packages) execution?
You can try using v$sql. But data is not persistent there.
SQL> create or replace procedure my_test_proc
2 as
3 l dual.dummy%type;
4 begin
5 select dummy into l from dual;
6 end;
7 /
Procedure created.
SQL> exec my_test_proc
PL/SQL procedure successfully completed.
SQL> select first_load_time,last_load_time,sql_text from v$sql where lower(sql_text) like '%my_test_proc%
2 /
FIRST_LOAD_TIME LAST_LOAD_TIME
SQL_TEXT
2008-11-12/17:04:06 2008-11-12/17:04:06
BEGIN my_test_proc; END;
Similar Messages
-
How to accept user values into a pl/sql procedure or function on every execution
As we accept user values on every execution in a C or a java program, is it possible to do so with a pl/sql procedure or a funtion without using parameters?
I cannot use parameters because it is required to be interactive while accepting the user-values like,
Please enter your date of birth in 'dd/mm/yyyy' format:It depends from where you are calling your PLSQL routine. If it is SQL*Plus then you can use & (ampersand) with the variable to be input at run time.
If you are executing the PLSQL routine from another application (some front end application) then it's not possible. Because when a procedure is executing at server side, the front end application does not have control, and the control is only transfered back to front end application when the PLSQL routine either completes successfully or throws an exception.
In either case, you can not go back to the PLSQL routine.
In this case, what you can do is, write code in your front end application to get that variable value from user and then pass that value to PLSQL routine. -
Last execution date and time of a transaction
Hi,
Could anyone let me know the procedure to find the last execution date and time of a transaction (for example MM01/MM02). We are currently working on ECC6.0
RajaHi Raja,
Check table CDHDR, fetch data against T code MM01/MM02 and get MAX(UDATE) and MAX(UTIME).
You will get last execution date and time.
Please reqward ponits if it useful.
Regards
Krish -
Need to know how to find the last execution time for a function module
HI all
I need to know
1) How to find out the last execution time of the function module ?
say for eg. I have executed a func. module at 1:39pm. How to retrieve this time (1:39pm)
2) I have created 3 billing document in tcode VF01 i.e 3 billing doucment no. would be created in SAP TABLE "VBRP" b/w 12am to 12:30 am.
How to capture the latest SAP database update b/w time intervals?
3) Suppose I am downloading TXT file using "GUI_DOWNLOAD" and say in 20th record some error has happened. I can capture the error using the exception.
Is it possible to run the program once again from 21st records ? All this will be running in background...
Kindly clarify....
Points will be rewarded
Thanks in advance1.Use tcode STAT input as Tcode of Fm and execute .
2. See the billing documents are created in table VBRk header and there will always be Creation date and time.
VBRk-Erdat "date ., u can check the time field also
So now if u talk the date and time we can filter then display the records in intervals.
3. with an error exeption how is my txt download finished .
once exception is raised there will not be a download .
regards,
vijay -
Function Module to find the Last Execution date of Back ground Job
Hi,
Is there any function module to find the <b>last execution date of back ground job</b>.
So that I can transfer the data from SAP to Legacy system based on the document creation date should be in between last execution date and current date.
thanks in advance.
Eswar.Don't know of a function module, but you should be able to use the information in table TBTCO to get the last start date and time of the job you are interested in.
-
Audit Procedure and Function Execution
Hello,
Does anyone know if Data Vault is capable of auditing procedure and function execution?
Regards,
HugoData Vault is a vault ... it does not perform auditing.
Audit Vault, the title of this forum, is a vault that stores audit trail information ... it is not an auditing creation tool.
If you want to audit procedure and function execution tell of your version and specifically what metrics you want for your audit trail.
Also look at the following:
http://www.morganslibrary.org/library.html
scroll down to OWA_UTIL
and look at the WHO_CALLED_ME procedure. -
Last execution time() function in webi
Hi Everybody,
If you use Last Execution time() function in webi it will give us something like: 9:36:53PM. But i need to minus 1hr from this.i should get the time as 8:36:53PM. Everytime i use this function i should minus one hour from the Last Execution Time().
Thanks in Advance.The following formula will return a last execution time minus an hour.
=If(FormatDate(LastExecutionDate(); "hh")="00"; "23"; FormatNumber(ToNumber(FormatDate(LastExecutionDate(); "hh"))-1;"00"))+FormatDate(LastExecutionDate(); ":mm:ss")
There may be a better way of doing it but I have not found it.
Regards
Alan -
Get Stored Procedure Last Execution time.
Hi,
I am looking to get last execution of store proc(My cache is flushed off). So would like to know all the store proc execution times.
sys.dm_exec_query_stats( as I known gets from cache, now all my cache is flushed)
Is there any way out.
N_14
Naveen| Press Yes if the post is useful.You may need to look at sys.dm_exec_procedure_stats.
As your cache is flushed, you will be unlikely to get this information without manual logging. -
Are the Pl/sql procedure and function atomic by themself
i want to ask a question does oracle pl/sql procedure and function support Atomicity for the database by themself , or they became atomic incase we call them using begin -- end;
You appear to be discussing transaction scope which is completely independent of PL/SQL blocks like procedures or how you call procedures. It's all in where commits (or rollbacks) are issued.
If you have a procedure like this
CREATE PROCEDURE p1
AS
BEGIN
INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
END;where the first statement succeeds and the second statement fails as a result of a duplicate key, there will still be a Foo row in the table but the procedure will have thrown an exception. The caller of the procedure may choose to commit or rollback the change-- that will determine whether the first statement's results are made permanent. If you have a procedure like this,
CREATE PROCEDURE p1
AS
BEGIN
INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
commit;
INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
END;the commit will make the first insert permanent regardless of whether the second statement fails no matter what the calling code does (that's one reason that putting commits in stored procedures is generally a bad idea-- the caller is in a much better position to know what other uncommitted work has been done and whether it is safe to commit.
Justin -
Program for the last execution of a program or a TC
Hello,
DO you know a program or a TC (Transaction) to edit the date and the hour of the last execution of a program or a TC.
Thank you for the help
Denis CorminboeufHi Denis,
I attached below parts of a program I created a couple of years ago to get use statistics on (customer) reports and transactions.
Maybe you can reuse parts of it for your needs.
Regards
Ferdi
<pre>
internal tables for use counter
data: begin of list occurs 5.
include structure sapwlserv.
data: end of list.
data: begin of applicat occurs 0.
include structure sapwlustcx.
data: end of applicat.
data: begin of applica_ occurs 0.
include structure sapwlustcx.
data: end of applica_.
data: begin of applicau occurs 0,
entry_id like sapwlustcx-entry_id,
account like sapwlustcx-account,
count like sapwlustcx-count,
: end of applicau.
data: wa_applicau like applicau.
*& Form MONI
form moni.
data: l_host like sapwlserv-hostshort.
m_start = p_usedt.
get server
call function 'SAPWL_SERVLIST_GET_LIST'
tables
list = list.
do.
loop at list.
loop on server
check not list-instshort is initial.
l_host = list-instshort.
get statistics per month and server
perform workload using m_start l_host.
endloop.
add 31 to m_start.
if m_start > sy-datum.
exit.
endif.
enddo.
sort applica_ by entry_id.
sort applicau by entry_id count descending.
endform. " MONI
*& Form WORKLOAD
form workload using p_start like sy-datum
p_host like sapwlserv-hostshort.
refresh: applica_.
read application statistic from MONI
call function 'SAPWL_WORKLOAD_GET_STATISTIC'
exporting
periodtype = 'M'
hostid = p_host
startdate = p_start
only_application_statistic = 'X'
tables
application_statistic = applica_
exceptions
unknown_periodtype = 1
no_data_found = 2
others = 3.
sort applica_ by entry_id account.
loop at applica_ where entry_id(1) ge 'Y'. "#EC PORTABLE
clear wa_applicau-entry_id.
wa_applicau-entry_id(25) = applica_-entry_id.
wa_applicau-account = applica_-account.
wa_applicau-count = applica_-count.
collect wa_applicau into applicau.
endloop.
sort applicau by entry_id count descending.
applica_-ttype = space.
applica_-account = space.
modify applica_ transporting ttype account
where ttype ne space.
collect only enhancements statistic
if p_temp = 'X'.
loop at applica_.
applica_-entry_id+25(48) = space.
collect applica_ into applicat.
endloop.
else.
loop at applica_ where entry_id(1) ge 'Y'. "#EC PORTABLE
applica_-entry_id+25(48) = space.
collect applica_ into applicat.
endloop.
endif.
endform. " WORKLOAD
</pre> -
PO Determine Price Procedure based on ordering Plant
Hi Experts,
Please advice how can we determine 2 pricing procedure for a vendor based on ordering Plant in purchase order?
Requirement: Client has central purchase organization (1000) for all plants. Now they are going for India rollout where Imports duties have come into picture. It is decided to create a separate pricing procedure ZINDIA and a vendor schema (IN) to determine the same. But since Pur Org is same we are not able to maintain 2 schemas and determine separate pricing procedures for India and other location. Client is neither ready to create an purchasing organization nor want to create separate vendor for India.
I know it is not in standard SAP solution, Is there any work around like some Z development or user exit to determine a pricing procedure other than that it determine based on vendor schema maintained in Vendor master.
With Regards
Sarvesh VashistHi Manu,
1.Could you please elaborate why u need two pricing schema for same vendor ?
My Requirement is to determine pricing procedure in purchase order other than what it is being determining based on vendor schema Pur Org Schema combination.
2.cant you fill up your req with cdn types and records. let me know ?
No, The VSR functionality does not serve here because the existing pricing procedure ZRM000 does not have India localization condition types. We have created a pricing procedure ZINDIA specific for India, but issue is for intercompany purchase if it determines ZRM000, Indian custom conditions are nt there.
3.Do your co have more than one purchasing org?
No.1 Purchase organization centrally.
Sarvesh -
OracleCallableStatement - can I access the procedure or function name?
I have an observer that, after preparing a statement, before execution, I need to know the stored procedure name of the prepareStatement (and go do an action, if necessary). I couldn't find a var in either OracleCallableStatement or OraclePreparedStatement that has this information, only the 'call' string, ie: { call myproc(?,?)}. For example (and I'm simply stating fact, not displaying preference :-) , SQLServerCallableStatement has a procedureName var (completely undocumented in their API) that I can access once the call has been prepared.
Any ideas?
THANKS!You can still use PL/SQL anonymous blocks to execute stored procedures and functions. In fact, it has its advantages, like being able to use named parameter association. However, your syntax is incorrect. It should be
... prepareCall("BEGIN <procedure name>(x=>?, y=>?, ...); END;") for a stored procedure
... prepareCall("BEGIN ? := <function_name>(x=>, y=>?, ...); END;") for a stored functionYou still do a java.sql.Connection.prepareCall(...) using this syntax. However, this returns a java.sql.CallableStatement. A call to prepareStatement(...) returns a java.sql.PreparedStatement which may not work. I know no way of getting the actual procedure or function name. -
Stored procedure and function - return table type
Hello again :)
I have one simple question :) Maybe on this forum the question was asked, but I found only similar question and they didn't help me.
It's possible return in Stored Function (with StoredProcedureFunction) as result return TABLE type? Or return table type with output parametr with Stored Procedure? Or instead of the table return the db object, but it is similar problem:)
Now, I can using db types TABLES or DB OBJECTS as INPUT parameters with call stored functions or procedures, for example:
I have this simple db object:
create or replace type BUFFER_DATA_R as object( detail VARCHAR2(4000 ))
And this simple table:
CREATE OR REPLACE TYPE BUFFER_DATA_T IS TABLE OF BUFFER_DATA_R
I create simple domain class object:
*public class DMBufferDataStruct {*
public String bufferData;
And I mapped in java with ObjectRelationalDataTypeDescriptor:
ObjectRelationalDataTypeDescriptor descriptor = new ObjectRelationalDataTypeDescriptor();
descriptor.setJavaClass(DMBufferDataStruct.class);
descriptor.setTableName("BUFFER_DATA_T");
descriptor.setStructureName("BUFFER_DATA_R");
descriptor.setPrimaryKeyFieldName("DETAIL");
descriptor.addFieldOrdering("DETAIL");
descriptor.addDirectMapping("bufferData", "DETAIL");
and join to server session ...
Well, i using this doimain class object as input parametr wih stored procedure call:
ObjectRelationalDatabaseField ordf = new ObjectRelationalDatabaseField("");
ordf.setSqlType(Types.STRUCT);
spCall.addNamedArgument(key, key,
Types.ARRAY,
"BUFFER_DATA_T",
ordf);
query.addArgument(key);
args.add(paramsInputs.get(key));
in paramsInputs is Vector of DMBufferDataStruct...
Well, this work fine!
But I can not figure, how to return this table from output parameters of stored procedure or as a return value from stored function?
Example of exceptions:
The number of arguments provided to the query for execution does not match the number of arguments in the query definition. - return as output parameter
PLS-00382: expression is of wrong type - used as result from stored function
So, my question is: Is possible return this table type from stored procedure or function? And if YES, how can I set output argument for call?
Thx advance!
Sorry for my English! :)
Best regards, KLDYour question is: what is faster PL/SQL or PL/SQL? And the answer is: it is PL/SQL of course!
As a general rule, you use a function when you return exactly one result: a number or a string or (more complex) instance of an object type or REF CURSOR or PL/SQL collection.
You use a procedure when:
a) you just do the job and return no result
b) you return multiple results - you can use multiple IN/OUT or OUT parameters
Imagine you have to write a program unit that performs a partitioned table maintenance by adding a partition.
You can implement this unit:
a) if you want return a "status code" (0 on successful completion or non-zero in case of error) then you should use a function
b) if you want no "status code" (in case of error an exception is raised that is handled outside of the program unit) then you should use a procedure
c) if you want "status code", name of tablespace where a partition was created (assume you program is so complex that it can choose different tablespaces based on metadata and free space available) and free space in that tablespace after the creation of a new partition then you should use a procedure with 3 OUT parameters.
But these are good programming practices that can be applied to (almost) any 3rd generation programming language, not only PL/SQL. -
How can I get a list of values (one or more) used in the WHERE filter of stored procedures and functions in SQL Server?
How can get a list of values as shown (highlighted) in the sample stored procedure below?
ALTER PROC [dbo].[sp_LoanInfo_Data_Extract] AS
SELECT [LOAN_ACCT].PROD_DT,
[LOAN_ACCT].ACCT_NBR,
[LOAN_NOTE2].OFCR_CD,
[LOAN_NOTE1].CURR_PRIN_BAL_AMT,
[LOAN_NOTE2].BR_NBR,
INTO #Table1
FROM
dbo.[LOAN_NOTE1],
dbo.[LOAN_NOTE2],
dbo.[LOAN_ACCT]
WHERE
[LOAN_ACCT].PROD_DT = [LOAN_NOTE1].PROD_DT
and
[LOAN_ACCT].ACCT_NBR = [LOAN_NOTE1].ACCT_NBR
and
[LOAN_NOTE1].PROD_DT = [LOAN_NOTE2].PROD_DT
and
[LOAN_NOTE1].MSTR_ACCT_NBR = [LOAN_NOTE2].MSTR_ACCT_NBR
and
[LOAN_ACCT].PROD_DT = '2015-03-10'
and
[LOAN_ACCT].ACCT_STAT_CD IN
('A','D')
and
[LOAN_NOTE2].LOAN_STAT_CD IN
('J','Z')
LenfinkelHi LenFinkel,
May I know what is purpose of this requirement, as olaf said,you may parse the T-SQL code (or the execution plan), which is not that easy.
I have noticed that the condition values in your Stored Procedure(SP) are hard coded and among them there is a date values, I believe some day you may have to alter the SP when the date expires. So why not declare 3 parameters of the SP instead hard coding?
For multiple values paramter you can use a
table-valued parameter. Then there's no problem getting the values.
If you could elaborate your purpose, we may help to find better workaround.
Eric Zhang
TechNet Community Support -
How to find out list of procedures and functions inside a package
How I can find out the list of Procedures and Functions inside a Package.
Look at ALL_PROCEDURES and ALL_ARGUMENTS.
Maybe you are looking for
-
TV Out Problem with Hermes 650
System : Hermes 650 Slim PC, V-Gear MyTV TV Capture card Software : V-Gear TV, PowerVCD Problem Description : When I use V-Gear TV software or PowerVCD to watch TV programs on TV thru the TV-Out output, everything ( ie the desktop, the apps etc ) are
-
Hello Does anyone have have a detailed documentation on the SPICDATA and SPICBOOKING functions? The BPC on-line help is a little poor on that aspect. Thanks a lot Regards
-
Indexing email addresses in Apple mail
I have newly installed the system and imported again my older previous email folders with thousands emails. Is there any way to "index" email addresses that when writing new emails, the email address will be automatically filled in when starting writ
-
Outlook 2007 - Can anyone get this to work?
Just wondering if anyone had success with this, it's really frustrating that the Oracle connector doesn't work with Outlook 2007.
-
We're running version 1.1 of the appliance, and version 1.1 of the app on iOS and Android, I'm curious about one of the QR code functions in the app. Everything I read says "scan a QR code to quickly connect your mobile device to a specific printer,"