Why thr r 2 options Is/As while creating procedure or function
why there are 2 options avialable IS/AS while creating procedure or function ?
Like
create or replace procedure test (p_nbr NUMBER) AS
create or replace procedure test (p_nbr NUMBER) IS
tried both the options observed same result..
Is thr any differnce between IS and AS ?
SShubhangi wrote:
why there are 2 options avialable IS/AS while creating procedure or function ?
Like
create or replace procedure test (p_nbr NUMBER) AS
create or replace procedure test (p_nbr NUMBER) IS
tried both the options observed same result..
Is thr any differnce between IS and AS ?Technically... there is no difference.
In terms of the English language, it would depend what you're describing...
[ do some action ] AS follows...
[ this object ] IS defined like this...
So in programming language terms you could say that:
create or replace procedure test (p_nbr NUMBER) AS...reads more naturally than
create or replace procedure test (p_nbr NUMBER) IS...because it is an "action" of creating or replacing something.
whereas, for example, a procedure in a package...
procedure test (p_nbr NUMBER) IS...is more clear than
procedure test (p_nbr NUMBER) AS...because this is stating what the procedure IS, rather than an action of creating it. (the package itself would be "create package ... AS")
As far as Oracle is concerned though, it doesn't care, they are both interchangable. For me personally, I like to use the one that makes it clearly readable.
Similar Messages
-
Compilation error while creating procedure
Hi,
I am getting compilation error while creating procedure
CREATE OR REPLACE My_CHANGEDATE IS
error_string VARCHAR2(400) := NULL;
BEGIN
Create table set_temp as select * from set;
CURSOR c1 is
SELECT a.SETNUM, b.CHANGEDATE from
set a, setsp_t2 b
where a.setnum = b.setnum
and trunc(a.changedate) < trunc(b.CHANGEDATE);
BEGIN
FOR rec IN c1 LOOP
UPDATE set SET changedate = rec.changedate
WHERE setnum = rec.setnum;
Insert into set_temp select * from set where setnum = rec.setnum;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
error_string := 'My_CHANGEDATE - '||SUBSTR(SQLERRM,1,350);
DBMS_OUTPUT.PUT_LINE(error_string);
RAISE;
END My_CHANGEDATE;I have taken your code and cleaned it up to be more readable. Please see the comments in the code.
CREATE OR REPLACE My_CHANGEDATE
IS
error_string VARCHAR2(400) := NULL;
BEGIN
/* The only way to issue DDL in a procedure is to either user
* DBMS_SQL or EXECUTE IMMEDIATE. Creating objects is generally
* not needed or recommended in frequently run code.
Create table set_temp as select * from set;
/* The cursor declarations need to go in the declaration section of the
* procedure (between IS .. BEGIN).
CURSOR c1 is
SELECT a.SETNUM, b.CHANGEDATE from
set a, setsp_t2 b
where a.setnum = b.setnum
and trunc(a.changedate) < trunc(b.CHANGEDATE);
BEGIN /* Where is the END that goes with this begin? */
/* Single record processing is generally not recommended. It is considered a "slow-by-slow" method. */
FOR rec IN c1 LOOP
UPDATE set SET changedate = rec.changedate
WHERE setnum = rec.setnum;
Insert into set_temp select * from set where setnum = rec.setnum;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
error_string := 'My_CHANGEDATE - '||SUBSTR(SQLERRM,1,350);
DBMS_OUTPUT.PUT_LINE(error_string);
RAISE;
END My_CHANGEDATE;My general recommendations are as follows:
1. Remove the CREATE TABLE from the procedure altogether.
2. Don't use reserved words for object names (e.g. SET)
3. Remove the record by record processing and consolidate it to a single UDPATE statement as follows (note untested):
UPDATE set s
SET changedate = (
SELECT CHANGEDATE
FROM SET A
, SETSO_T2 B
WHERE A.SETNUM = B.SETNUM
AND S.SETNUM = A.SETNUM
AND TRUNC(A.CHANGEDATE) < TRUNC(B.CHANGEDATE)
WHERE EXISTS(
SELECT NULL
FROM SET A
WHERE A.SETNUM = S.SETNUM
)HTH! -
Error while creating procedure and package
Hi,
I am getting an error while creating an procedure
create or replace procedure mke_test (mke_gender varchar2) is
begin
declare global temporary table mag_hotline_glob
INDIVIDUAL_ID NUMBER,
ONE_MONTH NUMBER,
THREE_MONTH NUMBER,
SIX_MONTH NUMBER,
TWELVE_MONTH NUMBER,
CHILDREN_PRES VARCHAR2(1 BYTE)
) with replace on commit preserve rows not logged;
begin
insert into mag_hotline_glob
select * from magazine_gender;
end;
end;
can anybody plz suggestIt's a total mess. You need to read the documentation first.
Create your table separately
CREATE global temporary table mag_hotline_glob(INDIVIDUAL_ID NUMBER,
ONE_MONTH NUMBER,
THREE_MONTH NUMBER,
SIX_MONTH NUMBER,
TWELVE_MONTH NUMBER,
CHILDREN_PRES VARCHAR2(1 BYTE)) with replace on commit preserve rows not logged;Then use the procedure (I don't know why, this INSERT statement you can fire yourself)
create or replace procedure mke_test(mke_gender varchar2) is
begin
insert into mag_hotline_glob
select * from magazine_gender;
end;If you want to create the GTT inside the procedure(should be avoided) then Use EXECUTE IMMEDIATE.
By the way, where are you using the IN parameter ? It' unnecessary. -
Cannot see any actions while creating a new function in CC5.2
Hi All,
We recently installed GRC Access Control 5.2.At the backend we are using SAP R/3 4.7.The system has been installed and I am currently trying to configure it.I am trying to create a new function.After chosing a function ID and description when I try to insert an action,it comes up blank for my production server and even if I choose the option "All".
Any assistance in the matter would be greatly appreciated.Helo Neo,
For making the functions, risks etc, you need to have some standard procedures being followed and up in place. Uploading transactions,, authorization objects and text are one of these.
Thus before you start actually using/implementing the GRC the system, I would like to advice you to go through the documentation for the same, which suggests the step by step procedure for accomplishing the same.
The problem that you have encountered is a bit easy to track as it suggests the Auth objects and texts might not probably be uploaded. But there might be something you have missed while going the procedural way, which may cause a lot of problems while troubleshooting.
Kindly upload the files in the config tab, under "Upload Objects" and let us know if there is still an issue.
Regards,
Hersh. -
Error while creating a simple function, procedure or triger in Oracle8i Lite
Hi,
I have Oracle8i Lite release 4.0.
While creating a simple proceudre/function/trigger on the database, it's throwing the following error:
create or replace function test return number is
ERROR at line 1:
OCA-30021: error preparing/executing SQL statement
[POL-5228] syntax error
Here is my sample code.
create or replace function test return number is
begin
return 0;
end;
Tried to create the same function in the user SYSTEM too but got the same error message.
Thanks in advance for the soluton.
nullI just started with 8i Lite, but as far as I know 8i Lite does not support PL/SQL code.
So you have to write your triggers and stored procedures in Java.
Ciao -
Error while creating webservice from function module in ECC
Hi
while creating a web service out of a function module in ECC, in the configure service section we get a message saying ' Remember that the service does not have any runtime configuration and therefore cannot be used. Create the Web service configuration in the NetWeaver Admninistrator (transaction WSADMIN2).'
instead of check box 'release for runtime'.
Our ECC at release 7 patch level 22.
Checked in SCICM, SICF teh service and the folder are active.
Please suggest if we are missing on anything
Regards
KumarIn new version on ECC, the runtime configurations needs to be performed in transaction SOAMANGER.
On executing the transaction, it opens a browser. The important configurations to be performed are:
1. Configure J2EE server and host. You can choose to provide the ECC server and host
2. Administration of the service in "Single Service Administration". The navigation path may differ depending of the ECC versions. But it is related to administration of the services.
Once done, check the WSDL generated.
Use this WSDL in the NWDS.
Regards,
Sharath -
PLS-00103 Error While Creating Procedure
I am attempting to create the following procedure following the guidelines in Metalink Doc ID #118040.1 and I keep receiving the following error at Line #22:
Error(22,65): PLS-00103: Encountered the symbol ":" when expecting one of the following: := . ( % ; The symbol ":= was inserted before ":" to continue.
Here is my procedure code:
PROCEDURE sw_load_image( position IN NUMBER, filename VARCHAR2) AS
f_lob BFILE;
b_lob BLOB;
image_name VARCHAR2(30);
mime_type VARCHAR2(30);
dot_pos NUMBER;
BEGIN
-- Find the position of the dot ('.') located in the filename
dot_pos := INSTR(filename, '.');
-- Get the filename without extension and use it as image name
image_name := SUBSTR(filename,1,dot_pos-1);
-- Build the mime type. Retrieve the file extension and add it to 'image/'
mime_type := 'image/'||SUBSTR( filename, dot_pos+1, length(filename) );
INSERT INTO sw_images values(position, image_name, mime_type, empty_blob() ) RETURN img_data INTO b_lob;
f_lob := BFILENAME('IMG2LOAD', filename);
dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
dbms_lob.loadfromfile(b_lob, f_lob, dbms_lob.getlength(f_lob) ):
dbms_lob.fileclose(f_lob);
COMMIT;
END;
Line #22 is the line that starts 'dbms_lob.loadfromfile'. I am not seeing where I have made a mistake. Does anyone else see where I've made a mistake?
This procedure is being created on a 9i database running on W2K server and W2K client.
Thanks,
JasonThanks! As many times as I looked at that I can't believe I didn't see that. Thanks again.
-
During Notification Creation I get the error --Partner Function is Not Allowed in Partner Determination Profile Q2
As I enter Purchase Document Number in the transaction QM01 and press Enter. I get the above error and donot go further.
Can anyone help me here.Hello Prashant,
You are missing some configuration for the partner function;
Go- to
SPRO>IMG>QM>Quality Notifications>Notification Creation>Partners>Define partner Determination Procedure>
Again Select "Define Partner Determination Procedure".
Select Quality management> Change Partner
Now Select Q2.
Compare settings with Partner Determination Procedure on any other client. Also check Partner functions on the same screen.
Amol. -
Error while creating Custom Defined Functions in Essbase
<p>Hi All,<br>I am trying to create CDF(Custom Defined Functions) in Essbase. Iwant to create a function which take list of child member andreturn the first child. For this, i have created a java file called"ChildAccess.java" which contains the following code:<br>public class ChildAccess<br>{<br>public static char GetFirstMember(char [] members)<br>{<br>return members[0];<br>}<br>}<br>I have compiled and made jar file called"ChildAccess.jar" and pasted it at"ARBORPATH/java/udf". Then i restarted the Essbase Serverand run the following MaxL command to register the function<br>create or replace function '@ChildAccess' as<br>'ChildAccess.GetFirstMember'<br>spec '@ChildAccess(memberRange)'<br>comment 'adds list of input members'.<br>Till here i am not getting any error but when i am using thisfunction in my calc script as given below<br><br>FIX(@ChildAccess(@CHILDREN("Abc")))<br><br>it gives the following error<br>"Error:1200414 Error parsing formula for [FIX STATEMENT]<br>(line 2)"argument[1] may not have size[6] in function[@CHILDREN]"<br>NOTE: The SIZE[6] is giving the no. of child in member"ABC".<br><br>Thanks in Advance<br>Arpit</p>
If you want to use the CDF in a FIX statement you need to make sure that it returns a member name rather than a number:<BR><i><BR>public class ChildAccess<BR>{<BR> public static String GetFirstMember(String[] members)<BR> {<BR> return members[0];<BR> }<BR>}<BR></i><BR>I prefer to define the function against a specific application rather than globally because you only need to restart the application in order to pick-up any modifications to the .jar file. So the MaxL function definition would be:<BR><i><BR> create or replace function appname.'@_GETFIRSTMEMBER' as<BR> 'ChildAccess.GetFirstMember(String[])';<BR></i><BR>and in the calculation script the FIX statement would become:<BR><i><BR> fix ( @member( @_GetFirstMember( @name( @children( "Abc" ) ) ) ) )<BR></i><BR>This looks a little messy so you can use a macro to simplify it:<BR><i><BR> create or replace macro appname.'@GETFIRSTMEMBER'(single) <BR> as '@member( @_GETFIRSTMEMBER( @name( @@1 ) ) )' <BR> SPEC "@GETFIRSTMEMBER(memberRange)";<BR></i><BR>and then the FIX statement could be written:<BR><i><BR> fix( @getfirstmember( @children( "PRODUCT" ) ) )<BR></i>
-
Error while creating procedure
i am creating the procedure which is having year as arguemnt (i am couting total number of user in year)
CREATE OR REPLACE PROCEDURE sample1 (a_year varchar2(4)) IS
BEGIN
select COUNT(*) Total_Count
from users a
where a.create_dt >= TO_DATE('01-JAN-'a_year, 'dd-mon-yyyy' )
and a.create_dt <= TO_DATE('31-DEC'a_year, 'dd-mon-yyyy' );
END sample1;if i am using cursor like below
CREATE OR REPLACE PROCEDURE sample1 (a_year char,p_Parent_RS IN OUT t_CursorPtr) IS
TYPE t_CursorPtr IS REF CURSOR;
BEGIN
OPEN p_Parent_RS FOR
select 'NEW ITEMS CREATED' Column_Name, COUNT(*) Total_Count
from attribs a
where a.create_dt >= TO_DATE('01-JAN-'||a_year, 'dd-mon-yyyy' )
and a.create_dt <= TO_DATE('31-DEC-'||a_year, 'dd-mon-yyyy' )
union all
-- new locations count
select 'NEW LOCATION COUNT' Column_Name, COUNT(*) Total_Count
from location a
where a.create_dt >= TO_DATE('01-JAN-'||a_year, 'dd-mon-yyyy' )
and a.create_dt <= TO_DATE('31-DEC-'||a_year, 'dd-mon-yyyy' )
union all
-- new interface nodes
select 'NEW INTERFACE NODE' Column_Name, COUNT(*) Total_Count
from interface_node a
where A.create_dt >= TO_DATE('01-JAN-'||a_year, 'dd-mon-yyyy' )
and a.create_dt <= TO_DATE('31-DEC-'||a_year, 'dd-mon-yyyy' )
union all
-- # of items with attributes
select 'ITEMS WITH ATTRIBUTE' Column_Name, COUNT(*) Total_Count
from attribs
where label_name_code not like '0'
--and component_code not like '0'
and item_act_inact_status = 'A'
and product_type_code IN ('FG','SF','BULK','SAM')
union all
-- total # of users
select 'TOTAL NUMBER OF USER' Column_Name, COUNT(*) Total_Count
from users a
where a.stat_code = 'A';
END sample1;i am getting below error
PLS-00201: identifier 'T_CURSORPTR' must be declared -
Issue with the Package/request while creating service from function module
Hi
I'm creating a service form a function module. After the web service creator starts, There is a last step that asks for package and transport request. If i choose local objects, showing error as "Test Objects cannot be created in foriegn namespaces. If i give the package as it is in the attributes of the function module and transport request, showing error as " No tasks exists under the request. What is transport request??
please if anyone has recently done such a process with NetWeaver PI 7.1. help me..
Thanks
VijayYou have to create a package for your objectsin SE80 transaction.
How?
http://www.sap-img.com/basis/steps-for-creating-package.htm
Then assign this package name in your webservice creation.
When asked for a transaport request, create one(You will find a create transport request inthe pop up which prompts you for creation of transport request).
Regards,
ravi kanth talagana -
Very weird ORA-06502 error while creating procedure
Hi All,
i try to create the following procedure (on a 10.2 database):
create or replace procedure audit_report
as
cursor c_audit_user (b_start_date date, b_end_date date)
is
select user_id
, os_user
, session_id
, host
, last_program
, last_action
, last_module
, to_char(logon_day,'dd-mm-yyyy') logon_day
, logon_time
, to_char(logoff_day,'dd-mm-yyyy') logoff_day
, logoff_time
, elapsed_minutes
from audit_user
where logon_day >= b_start_date
and logon_day < b_end_date
order by logon_day desc
cursor c_audit_ddl (b_start_date in date, b_end_date in date)
is
select user_name
, to_char(ddl_date,'dd-mm-yyyy hh24:mi:ss') ddl_date
, ddl_type
, object_type
, owner
, object_name
, sql_text
from audit_ddl
where ddl_date >= b_start_date
and ddl_date < b_end_date
order by ddl_date desc
cursor c_audit_trail (b_start_date in date, b_end_date in date)
is
select os_username
, username
, to_char(timestamp,'dd-mm-yyyy hh24:mi:ss') timestamp
, owner
, obj_name
, to_char(action) action
, action_name
, decode(ses_actions,'---S------------','DELETE',
'------S---------','INSERT',
'---------S------','SELECT',
'----------S-----','UPDATE',
'---S--S--S------','DELETE/INSERT/SELECT',
'---S--S--SS-----','DELETE/INSERT/SELECT/UPDATE',
'------S--S------','INSERT/SELECT',
'------S--SS-----','INSERT/SELECT/UPDATE',
'---------SS-----','SELECT/UPDATE',
'DDL ACTION') ses_actions
, priv_used
from dba_audit_Trail
where username <> 'DBSNMP'
and timestamp >= b_start_date
and timestamp < b_end_date
order by timestamp desc
v_header_user varchar2(255);
v_sep_user varchar2(255);
v_header_ddl varchar2(255);
v_sep_ddl varchar2(255);
v_header_dml varchar2(255);
v_sep_dml varchar2(255);
v_record_user varchar2(255);
v_record_ddl varchar2(255);
v_record_dml varchar2(255);
v_report utl_file.file_type;
v_file_dir varchar2(255);
v_file_name varchar2(255);
v_start_date date;
v_end_date date;
v_db_name varchar2(255);
begin
-- Find start and end date of previous week (Sunday to Monday)
if to_char(sysdate,'DAY') = 'MONDAY' then
v_start_date := trunc(sysdate-8);
v_end_date := trunc(sysdate-1);
elsif
to_char(sysdate,'DAY') = 'TUESDAY' then
v_start_date := trunc(sysdate-9);
v_end_date := trunc(sysdate-2);
elsif
to_char(sysdate,'DAY') = 'WEDNESDAY' then
v_start_date := trunc(sysdate-10);
v_end_date := trunc(sysdate-3);
elsif
to_char(sysdate,'DAY') = 'THURSDAY' then
v_start_date := trunc(sysdate-11);
v_end_date := trunc(sysdate-4);
elsif
to_char(sysdate,'DAY') = 'FRIDAY' then
v_start_date := trunc(sysdate-12);
v_end_date := trunc(sysdate-5);
elsif
to_char(sysdate,'DAY') = 'SATURDAY' then
v_start_date := trunc(sysdate-13);
v_end_date := trunc(sysdate-6);
elsif
to_char(sysdate,'DAY') = 'SUNDAY' then
v_start_date := trunc(sysdate-14);
v_end_date := trunc(sysdate-7);
end if;
--Fill headers
v_header_user := 'USER_ID OS_USER SESSION_ID HOST LAST_PROGR'||
' LAST_ACTION LAST_MODULE LOGON_DAY'||
' LOGON_TI LOGOFF_DAY LOGOFF_T ELAPSED_MINUTES';
v_sep_user := '---------- --------- ---------- -------- ----------'||
'-------------------- ----------- ----------- ---------'||
v_header_ddl := 'USER_NAME DDL_DATE DDL_TYPE OBJECT_TYPE'||
' OWNER OBJECT_NAME SQL_TEXT';
v_sep_ddl := '---------- --------------------- ---------- -----------'||
'--------- ---------- -------------------- -------------'||
v_header_dml := 'OS_USERNAME USERNAME TIMESTAMP OWNER'||
' OBJ_NAME ACTION ACTION_NAME SES_ACTIONS'||
' PRIV_USED';
v_sep_dml := '----------- ---------- --------------------- ---------- '||
'--------------- ------ --------------- ------------------'||
--Create audit report file
v_file_dir := 'AUDIT_REPORT_DIR';
select name
into v_db_name
from v$database;
v_file_name := 'audit_report_'||v_db_name||'_'||to_char(v_start_date,'yyyymmdd')||'-'||to_char(v_end_date-1,'yyyymmdd')||'.log';
v_report := utl_file.fopen(v_file_dir, v_file_name, 'w');
--Report Header
utl_file.put_line(v_report,'AUDIT REPORT');
utl_file.put_line(v_report,'------------');
utl_file.put_line(v_report,'Database: '||v_db_name);
utl_file.put_line(v_report,'From : '||to_char(trunc(v_start_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'To : '||to_char(trunc(v_end_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'Created : '||to_char(sysdate,'dd-mm-yyyy hh24:mi:ss'));
utl_file.new_line(v_report);
--Report Detail records
utl_file.put_line(v_report,v_header_user);
utl_file.put_line(v_report,v_sep_user);
for r_audit_user in c_audit_user(v_start_date,v_end_date) loop
v_record_user := rpad(r_audit_user.user_id,11,' ')||
rpad(r_audit_user.os_user,11,' ')||
rpad(r_audit_user.session_id,11,' ')||
rpad(r_audit_user.host,9,' ')||
rpad(r_audit_user.last_program,31,' ')||
rpad(r_audit_user.last_action,12,' ')||
rpad(r_audit_user.last_module,12,' ')||
rpad(r_audit_user.logon_day,11,' ')||
rpad(r_audit_user.logon_time,9,' ')||
rpad(r_audit_user.logoff_day,11,' ')||
rpad(r_audit_user.logoff_time,9,' ')||
lpad(r_audit_user.elapsed_minutes,15,' ');
utl_file.put_line(v_report,v_record_user);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_ddl);
utl_file.put_line(v_report,v_sep_ddl);
for r_audit_ddl in c_audit_ddl(v_start_date,v_end_date) loop
v_record_ddl := rpad(r_audit_ddl.user_name,11,' ')||
rpad(r_audit_ddl.ddl_date,22,' ')||
rpad(r_audit_ddl.ddl_type,11,' ')||
rpad(r_audit_ddl.object_type,21,' ')||
rpad(r_audit_ddl.owner,11,' ')||
rpad(r_audit_ddl.object_name,21,' ')||
rpad(r_audit_ddl.sql_text,100,' ');
utl_file.put_line(v_report,v_record_ddl);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_dml);
utl_file.put_line(v_report,v_sep_dml);
for r_audit_trail in c_audit_trail(v_start_date,v_end_date) loop
v_record_dml := rpad(r_audit_trail.os_username,12,' ')||
rpad(r_audit_trail.username,11,' ')||
rpad(r_audit_trail.timestamp,22,' ')||
rpad(r_audit_trail.owner,11,' ')||
rpad(r_audit_trail.obj_name,16,' ')||
rpad(r_audit_trail.action,7,' ')||
rpad(r_audit_trail.action_name,16,' ')||
rpad(r_audit_trail.ses_actions,19,' ')||
rpad(r_audit_trail.priv_used,20,' ');
utl_file.put_line(v_report,v_record_dml);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report, '*** End of report ***');
utl_file.fclose(v_report);
end;
This gives me the following error:
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 8
When i try to create the procedure as this, i get the same error:
create or replace procedure audit_report
as
/*cursor c_audit_user (b_start_date date, b_end_date date)
is
select user_id
, os_user
, session_id
, host
, last_program
, last_action
, last_module
, to_char(logon_day,'dd-mm-yyyy') logon_day
, logon_time
, to_char(logoff_day,'dd-mm-yyyy') logoff_day
, logoff_time
, elapsed_minutes
from audit_user
where logon_day >= b_start_date
and logon_day < b_end_date
order by logon_day desc
cursor c_audit_ddl (b_start_date in date, b_end_date in date)
is
select user_name
, to_char(ddl_date,'dd-mm-yyyy hh24:mi:ss') ddl_date
, ddl_type
, object_type
, owner
, object_name
, sql_text
from audit_ddl
where ddl_date >= b_start_date
and ddl_date < b_end_date
order by ddl_date desc
cursor c_audit_trail (b_start_date in date, b_end_date in date)
is
select os_username
, username
, to_char(timestamp,'dd-mm-yyyy hh24:mi:ss') timestamp
, owner
, obj_name
, to_char(action) action
, action_name
, decode(ses_actions,'---S------------','DELETE',
'------S---------','INSERT',
'---------S------','SELECT',
'----------S-----','UPDATE',
'---S--S--S------','DELETE/INSERT/SELECT',
'---S--S--SS-----','DELETE/INSERT/SELECT/UPDATE',
'------S--S------','INSERT/SELECT',
'------S--SS-----','INSERT/SELECT/UPDATE',
'---------SS-----','SELECT/UPDATE',
'DDL ACTION') ses_actions
, priv_used
from dba_audit_Trail
where username <> 'DBSNMP'
and timestamp >= b_start_date
and timestamp < b_end_date
order by timestamp desc
v_header_user varchar2(255);
v_sep_user varchar2(255);
v_header_ddl varchar2(255);
v_sep_ddl varchar2(255);
v_header_dml varchar2(255);
v_sep_dml varchar2(255);
v_record_user varchar2(255);
v_record_ddl varchar2(255);
v_record_dml varchar2(255);
v_report utl_file.file_type;
v_file_dir varchar2(255);
v_file_name varchar2(255);
v_start_date date;
v_end_date date;*/
v_db_name varchar2(255);
begin
/*-- Find start and end date of previous week (Sunday to Monday)
if to_char(sysdate,'DAY') = 'MONDAY' then
v_start_date := trunc(sysdate-8);
v_end_date := trunc(sysdate-1);
elsif
to_char(sysdate,'DAY') = 'TUESDAY' then
v_start_date := trunc(sysdate-9);
v_end_date := trunc(sysdate-2);
elsif
to_char(sysdate,'DAY') = 'WEDNESDAY' then
v_start_date := trunc(sysdate-10);
v_end_date := trunc(sysdate-3);
elsif
to_char(sysdate,'DAY') = 'THURSDAY' then
v_start_date := trunc(sysdate-11);
v_end_date := trunc(sysdate-4);
elsif
to_char(sysdate,'DAY') = 'FRIDAY' then
v_start_date := trunc(sysdate-12);
v_end_date := trunc(sysdate-5);
elsif
to_char(sysdate,'DAY') = 'SATURDAY' then
v_start_date := trunc(sysdate-13);
v_end_date := trunc(sysdate-6);
elsif
to_char(sysdate,'DAY') = 'SUNDAY' then
v_start_date := trunc(sysdate-14);
v_end_date := trunc(sysdate-7);
end if;
--Fill headers
v_header_user := 'USER_ID OS_USER SESSION_ID HOST LAST_PROGR'||
' LAST_ACTION LAST_MODULE LOGON_DAY'||
' LOGON_TI LOGOFF_DAY LOGOFF_T ELAPSED_MINUTES';
v_sep_user := '---------- --------- ---------- -------- ----------'||
'-------------------- ----------- ----------- ---------'||
v_header_ddl := 'USER_NAME DDL_DATE DDL_TYPE OBJECT_TYPE'||
' OWNER OBJECT_NAME SQL_TEXT';
v_sep_ddl := '---------- --------------------- ---------- -----------'||
'--------- ---------- -------------------- -------------'||
v_header_dml := 'OS_USERNAME USERNAME TIMESTAMP OWNER'||
' OBJ_NAME ACTION ACTION_NAME SES_ACTIONS'||
' PRIV_USED';
v_sep_dml := '----------- ---------- --------------------- ---------- '||
'--------------- ------ --------------- ------------------'||
--Create audit report file
v_file_dir := 'AUDIT_REPORT_DIR';
select name
into v_db_name
from v$database;
v_file_name := 'audit_report_'||v_db_name||'_'||to_char(v_start_date,'yyyymmdd')||'-'||to_char(v_end_date-1,'yyyymmdd')||'.log';
v_report := utl_file.fopen(v_file_dir, v_file_name, 'w');
--Report Header
utl_file.put_line(v_report,'AUDIT REPORT');
utl_file.put_line(v_report,'------------');
utl_file.put_line(v_report,'Database: '||v_db_name);
utl_file.put_line(v_report,'From : '||to_char(trunc(v_start_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'To : '||to_char(trunc(v_end_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'Created : '||to_char(sysdate,'dd-mm-yyyy hh24:mi:ss'));
utl_file.new_line(v_report);
--Report Detail records
utl_file.put_line(v_report,v_header_user);
utl_file.put_line(v_report,v_sep_user);
for r_audit_user in c_audit_user(v_start_date,v_end_date) loop
v_record_user := rpad(r_audit_user.user_id,11,' ')||
rpad(r_audit_user.os_user,11,' ')||
rpad(r_audit_user.session_id,11,' ')||
rpad(r_audit_user.host,9,' ')||
rpad(r_audit_user.last_program,31,' ')||
rpad(r_audit_user.last_action,12,' ')||
rpad(r_audit_user.last_module,12,' ')||
rpad(r_audit_user.logon_day,11,' ')||
rpad(r_audit_user.logon_time,9,' ')||
rpad(r_audit_user.logoff_day,11,' ')||
rpad(r_audit_user.logoff_time,9,' ')||
lpad(r_audit_user.elapsed_minutes,15,' ');
utl_file.put_line(v_report,v_record_user);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_ddl);
utl_file.put_line(v_report,v_sep_ddl);
for r_audit_ddl in c_audit_ddl(v_start_date,v_end_date) loop
v_record_ddl := rpad(r_audit_ddl.user_name,11,' ')||
rpad(r_audit_ddl.ddl_date,22,' ')||
rpad(r_audit_ddl.ddl_type,11,' ')||
rpad(r_audit_ddl.object_type,21,' ')||
rpad(r_audit_ddl.owner,11,' ')||
rpad(r_audit_ddl.object_name,21,' ')||
rpad(r_audit_ddl.sql_text,100,' ');
utl_file.put_line(v_report,v_record_ddl);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_dml);
utl_file.put_line(v_report,v_sep_dml);
for r_audit_trail in c_audit_trail(v_start_date,v_end_date) loop
v_record_dml := rpad(r_audit_trail.os_username,12,' ')||
rpad(r_audit_trail.username,11,' ')||
rpad(r_audit_trail.timestamp,22,' ')||
rpad(r_audit_trail.owner,11,' ')||
rpad(r_audit_trail.obj_name,16,' ')||
rpad(r_audit_trail.action,7,' ')||
rpad(r_audit_trail.action_name,16,' ')||
rpad(r_audit_trail.ses_actions,19,' ')||
rpad(r_audit_trail.priv_used,20,' ');
utl_file.put_line(v_report,v_record_dml);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report, '*** End of report ***');
utl_file.fclose(v_report);*/
null;
end;
So all code is commented out, but still the error.
Any ideas?
Kind regards,
Davejust out of interest, what output do you get if you desc user_source?
I get:
NAME VARCHAR2(30)
TYPE VARCHAR2(12)
LINE NUMBER
TEXT VARCHAR2(4000) -
Error MG-144 occurring while creating article by function module
Hi Experts,
I have requirement to create the article in MM41 by function module, I have used WRF_MATERIAL_MAINTAINDATA_RT function module. But it is giving error MG-144 saying the field MARC-DISMM is defined as required field ; it doesn't contain any entry. I am passing values to planatdata-mrp_type and planatdatax-mrp_type = 'X' also. Please help me out. Thanks In advance.
With Regard's
madhu.The CREATE FM should not only create the entry, it should also EXPORT the key that it uses to create the entry. Is it doing that?
i.e. the CREATE signature is usually something like:
CREATE_BLAH
IMPORTING header TYPE header_row
EXPORTING key type header_row-key_field.
So the 'key' here should be filled by the FM and returned to DOE. -
Avoid Email address check while creating or changes functional location PM
Hi Experts,
We have upgraded 4.6C system to ECC 6.0 with EHP4.
We are tring to change the existing functional location created in 4.6c through tcode IL02 -> location tab -> Email address.
and tring to maintain value as 'CAP 20/20/97' in email address field but it pop-ups with the error message as
'Email address 'CAP 20/20/97' is invalid'.
We know this is a SAP standard check but as part of the AS IS functionality, end user is able to maintain the same value in 4.6c and expecting same in ECC 6.0.
NOte : End user is using this field SMTP_ADDR (Email address) for multiple purposes.
When we reached SAP, following is the SAP responce.
This validity check is in compliance with RFC 2822.
This behaviour is standard since note 799902. If you would like to see
this functionality changed then please proceed as outlined in the
attached note 11.
Can any one provide work around solution to avoid the Email address validity check ?
Regards,
Suresh Goud.Hi Pete,
I just want to find out the reason for occuring this issue in ECC 6.0. Is because of any incomplete validation / missing configuration / implementation of any other SAP Note ? PFA the SAP note details for your easy reference.
SAP Note No. 1546997
Number 1546997
Version 1
Processor
Processing Status New
Implement. Status Cannot be implemented
Language EN
Short Text Correction of translation of '<Email address & invalid>'
Component XX-TRANSL-NL
Long Text
Symptom
Wrong translation /
Reason and Prerequisites
Solution
Translation of objects using transaction SE63 (see further below)
Transport Object(s):
PgID Object Name
LIMU MESS XS138
Package: SCON
Software Component: SAP_BASIS
Application Component: BC-SRV-COM
Translation Guideline:
English Text: Email address
Other terms
SE63, SE91
Valid Releases
SAP Basis component
SAP Note No. 1546997 11/11/2013 Page 2
46C
620
640
700
710
711
701
702
720
730
Links to Support Packages
Software Component Release Package Name
Thanks & Regards,
Lakshmi S -
Getting error while creating condition type in SPRO
Hi ,
can somebdy tell me why i am getting the following error while creating condition type in SPRO
No valid change license available for message /sapcnd/
and also while rule determination using condition type we are getting the following error.
system error:system cannot read the structure for table
reg
venkatHi Venkat,
Do you have the error number code!?
Regards,
Michel Bohn
Maybe you are looking for
-
Sent messages not saved in sent mailbox
Lately some iCloud sent messages are not saved in the sent mailbox. this is an intermitant problem. sometimes msgs go to the outbox even though mail is on line; when they are eventually sent sometimes they do not make it to the sent mailbox. I cal
-
HT201064 Fresh Mavericks install, iPhoto installed from DVD - won't update via the App Store
Hi all I did a fresh install of Mavericks, then installed a few apps from the App store. I then remembered iPhoto etc. that I have from the original install discs (2012 MBP)...but whilst iPhoto says an update is available (9.5.1), and launches the Ap
-
Hi, We have a possible opportunity with specific requirements for mobile application development. So before making commitment to the customer we would like to have answers to few questions. Is there anyone who belongs to core ADF team or ADF expert w
-
What can I do to stop the pass word at start up for mac mini?
What can I do to stop the pass word at start up for mac mini?
-
Can we set complete status of delivery
As in sales order we can use reason of rejection to set complete status of sales order similarly is there anyway we can set complete status of delivery at vl02n.(except pgi ofcourse) Regards, Sam