Set Custom CSS inline property in OAF


  • Import the below library 
    • import oracle.cabo.style.CSSStyle;
  • Create new CSS Style
    • CSSStyle noteStyle = new CSSStyle();
  • Add the Style property
    • noteStyle.setProperty("font-size","15px");
  • Assign the style to message Style Text Field
    • noteMsgBean.setInlineStyle(noteStyle);

Complete Code:

OAMessageStyledTextBean noteMsgBean = (OAMessageStyledTextBean)webBean.findChildRecursive("NotesRN");

    CSSStyle noteStyle = new CSSStyle();

    noteStyle.setProperty("font-size","15px");

noteMsgBean.setValue(pageContext,validNoteMsg);

noteMsgBean.setInlineStyle(noteStyle);

Read More »
Blogger Tricks
*/

String Functions and Operators

The concatenation operator (||) is used for joining two strings.

String functions are:

  • ASCII(x);
  • CHR(x);
  • CONCAT(x, y);
  • INITCAP(x);
  • INSTR(x, find_string [, start] [, occurrence]);
  • INSTRB(x); 
  • LENGTH(x); 
  • LENGTHB(x); 
  • LOWER(x); 
  • LPAD(x, width [, pad_string]) ; 
  • LTRIM(x [, trim_string]); 
  • NANVL(x, value); 
  • NLS_INITCAP(x); 
  • NLS_LOWER(x) ; 
  • NLS_UPPER(x); 
  • NLSSORT(x); 
  • NVL(x, value); 
  • NVL2(x, value1, value2); 
  • REPLACE(x, search_string, replace_string); 
  • RPAD(x, width [, pad_string]); 
  • RTRIM(x [, trim_string]); 
  • SOUNDEX(x) ; 
  • SUBSTR(x, start [, length]); 
  • SUBSTRB(x); 
  • TRIM([trim_char FROM) x); 
  • UPPER(x);

 Sample code:

DECLARE

v_company_name varchar2(11) := 'Ask Haressh Technical Blog';

BEGIN

dbms_output.put_line(UPPER(v_company_name)); -- Convert string to upper case

dbms_output.put_line(LOWER(v_company_name)); -- Convert string to lower case

dbms_output.put_line(INITCAP(v_company_name)); -- Convert string as First letter as Upper and remaining as lower case

dbms_output.put_line ( SUBSTR (v_company_name, 1, 1)); -- Get the first letter from string

dbms_output.put_line ( SUBSTR (v_company_name, -1, 1)); -- Get the last letter from string


/* retrieve the five characters, 

starting from the seventh position. */

dbms_output.put_line ( SUBSTR (v_company_name, 7, 5));


/* retrieve the remaining of the string,

starting from the second position. */

dbms_output.put_line ( SUBSTR (v_company_name, 2));


/* find the location of the first "e" */

dbms_output.put_line ( INSTR (v_company_name, 'e'));

END;


Sample Code:

DECLARE

v_company_name varchar2(30) := '......Ask Hareesh.....';

BEGIN

dbms_output.put_line(RTRIM(v_company_name,'.'));

dbms_output.put_line(LTRIM(v_company_name, '.'));

dbms_output.put_line(TRIM( '.' from v_company_name));

END;

Read More »
*/

PLSQL - LOOP

LOOP:


LOOP
statements;
END LOOP;

EXIT:

There are two forms of the EXIT.
  • EXIT
  • EXIT-WHEN

LOOP
statements;
IF <condition> THEN
EXIT;   -- exit loop immediately
END IF;
END LOOP;


Example of Loop:

Declare
y number;
Begin
y :=  1;
Loop
dbms_output.put_line(y);
y := y + 2;
exit when y > 10;
End Loop;
End;

FOR LOOP

FOR <counter> IN [REVERSE]
lower_bound .. higher_bound LOOP
statements;
END LOOP

Example to print numbers from 1 to 10 using FOR Loop:

begin
for x in 1..10
Loop
dbms_output.put_line(x);
End Loop;
end;

Example to print numbers from 10 to 1 (in reverse) using FOR Loop:

Begin
for  index in REVERSE 1 ..10
Loop
dbms_output.put_line(index);
End Loop;
end;

Complete Tutorial

Read More »
*/

PLSQL - Nested Loops

Syntax:

DECLARE

BEGIN

LOOP

EXIT WHEN TRUE

LOOP

EXIT WHEN TRUE

END LOOP

END LOOP

END

Example for Nested Loop:

declare

v_dept number;

v_emp number;

begin

v_dept := 1;

loop -- First 4 departments Loop

exit when v_dept > 4;

v_emp := 1;

loop -- First 3 Employees Loop

exit when v_emp >= 3;

v_emp := v_emp + 1;

end loop;

v_dept := v_dept + 1;

end loop;

end;

Complete Tutorial

Read More »
*/

PLSQL - Difference between While and Loop

While Loop v/s Basic Loop

  • While loop will execute only when condition evaluates true

declare

x number;

Begin

x := 1;

while x > 15

Loop

dbms_output.put_line(x);

x := x + 1;

End Loop;

end;


Basic Loop

  • The loop gets executed at least one time.


Declare

x number;

Begin

x :=  1;

Loop

dbms_output.put_line(x);

exit when x = 1;

x := x + 1;

End Loop;

End;

Complete Tutorial

Read More »
*/

PLSQL - While Loop

 

WHILE:

We can use While loop to evaluate before each iteration

Statement executed and control resumes at the top of the loop when condition evaluates to TRUE

Loop is bypassed and control passes to next statement when condition evaluates to FALSE

Number of iterations depends on the condition and is unknown until the loop completes


WHILE <condition>

LOOP

statements;

END LOOP;

Example to display 1 to 15 using while loop

declare

x number;

Begin

x := 1;

while x <=15

Loop

dbms_output.put_line(x);

x := x + 1;

End Loop;

end;


Example to Force a loop to complete unconditionally


declare

x number;

/*Use exit after z reaches to 8*/

Begin

x := 1;

while x <=15

Loop

dbms_output.put_line(x);

x := x + 1;

exit when x = 8;

End Loop;

end;

Complete Tutorial

Read More »
*/

PLSQL - Nested Blocks & Scope of variables


 Nested Blocks

declare

v_outer number;

begin

v_outer := 80;

dbms_output.put_line('Outer Block');

declare

v_inner number;

begin

v_inner := 90;

dbms_output.put_line('Inner Block');

dbms_output.put_line('Inner Block variable value ' || v_inner);

end;

dbms_output.put_line('Outer Block variable value ' || v_outer);

end;


Scope of variables

The variable declared in the outer block can be accessed by inner block but inner block variable can not be accessed by outer block.

declare

v_outer number;

begin

v_outer := 100;

declare

v_inner number;

begin

v_inner := 110;

dbms_output.put_line('Inner Block variable value ' || v_inner);

dbms_output.put_line('Outer block variable is accessible in the inner block');

dbms_output.put_line('Outer block variable value ' || v_outer);  

end;

dbms_output.put_line('Outer Block variable value ' || v_outer);

dbms_output.put_line('Inner Block variable value ' || v_inner);

end;


Labels

If the variables names of the outer and inner blocks are same then labels have to be used within the inner block to avoid confusion.

<<outer_block>>

declare

v_salary number;

begin

<<inner_block>> 

declare

v_salary  number := 100;

begin

dbms_output.put_line('Value of the inner block is ' || v_salary);

-- Giving value of v_salary of the inner block to the outer block v_salary

outer_block.v_salary :=inner_block. v_salary;

end;

v_salary := v_salary + 500;

dbms_output.put_line('Value of the outer block is ' || v_salary);

end;

Complete Tutorial

Read More »
*/