Declareis_locked boolean := false;dummy VARCHAR2(2);BeginBeginSelect null INTO dummy from mytablewhere rowid = :myblock.rowidfor update nowait;exception when Others thenIf sqlcode = -00054 Thenis_locked := True;End If; end;IF is_locked thenShowmessage('Another user is updating this record. Try again later.');raise form_trigger_failure;ElseLOCK_RECORD;If Not Form_success ThenRAISE form_trigger_failure;End If;End if;End;
http://forums.oracle.com/forums/thread.jspa?threadID=322077
Tuesday, December 14, 2010
Sunday, October 17, 2010
How to handler special characters
CREATE OR REPLACE FUNCTION strip_special_character ( in_string IN varchar2,in_chars IN varchar2 DEFAULT NULL) RETURN varchar2 IS
TAB CHAR(1) := chr(9);
double_quote char( 1 ) := chr(34);
single_quote char( 1 ) := chr(39);
mask varchar2( 80 ) := '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
v_special_chars varchar2( 80 ) := '`~^\'double_quotesingle_quotetab;
begin
IF in_chars IS NOT NULL then
v_special_chars := in_chars;
end
IF; RETURN translate( in_string, mask v_special_chars, mask );
exception when others then RETURN in_string;
end strip_special_character;
TAB CHAR(1) := chr(9);
double_quote char( 1 ) := chr(34);
single_quote char( 1 ) := chr(39);
mask varchar2( 80 ) := '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
v_special_chars varchar2( 80 ) := '`~^\'double_quotesingle_quotetab;
begin
IF in_chars IS NOT NULL then
v_special_chars := in_chars;
end
IF; RETURN translate( in_string, mask v_special_chars, mask );
exception when others then RETURN in_string;
end strip_special_character;
How to remove Unnecessary Spaces
CREATE FUNCTION remove_unwanted_spaces( in_value IN VARCHAR2 )
RETURN VARCHAR2
AS
v_result VARCHAR2(32767);
BEGIN
IF( in_value IS NOT NULL ) THEN
FOR i IN 1 .. ( LENGTH(in_value) - 1 ) LOOP
IF( SUBSTR( in_value, i, 2 ) <> ' ' ) THEN
v_result := v_result SUBSTR( in_value, i, 1 );
END IF;
END LOOP;
v_result := v_result SUBSTR( in_value, -1 );
END IF;
RETURN v_result;
END;
RETURN VARCHAR2
AS
v_result VARCHAR2(32767);
BEGIN
IF( in_value IS NOT NULL ) THEN
FOR i IN 1 .. ( LENGTH(in_value) - 1 ) LOOP
IF( SUBSTR( in_value, i, 2 ) <> ' ' ) THEN
v_result := v_result SUBSTR( in_value, i, 1 );
END IF;
END LOOP;
v_result := v_result SUBSTR( in_value, -1 );
END IF;
RETURN v_result;
END;
Sunday, September 19, 2010
Friday, September 17, 2010
ORACLE APPS TRAINING, STRUCTUR AND PRACTIVE
Get registred on http://vis1211.solutionbeacon.net for the practive of Oracle ERP.
We can findout lot of materail for Oracle ERP http://etrm.oracle.com by getting registration on it.
We can findout lot of materail for Oracle ERP http://etrm.oracle.com by getting registration on it.
Wednesday, September 15, 2010
SQL%NOTFOUND
Don't use this inside the for loop LIKE FOR
FOR i IN (SELECT sch_id,CURDATE FROM ORDERS)
LOOP
DON'T USE(EXIT WHEN SQL%NOTFOUND);
FOR i IN (SELECT sch_id,CURDATE FROM ORDERS)
LOOP
DON'T USE(EXIT WHEN SQL%NOTFOUND);
Tuesday, September 14, 2010
Use of NOCOPY with Oracle Function and Procedures.
• NOCOPY will instruct Oracle to pass the argument as fast as possible. This can significantly enhance performance when passing a large value.
• Ussually IN paramter is pass by value and OUT/IN OUT are pass by refererence....
If one wants to send the IN paramter too as pass by reference he could add NOCOPY
parameter....
advantage is always less memory usage
disadvantage is when there is a change happened to the Reffered value and a rollback occurs in the procedure the change of value would be retained.... it could not be rolled back....
so I beleive that it is always safe to work without the NOCOPY parameter.....
• Ussually IN paramter is pass by value and OUT/IN OUT are pass by refererence....
If one wants to send the IN paramter too as pass by reference he could add NOCOPY
parameter....
advantage is always less memory usage
disadvantage is when there is a change happened to the Reffered value and a rollback occurs in the procedure the change of value would be retained.... it could not be rolled back....
so I beleive that it is always safe to work without the NOCOPY parameter.....
Subscribe to:
Posts (Atom)