Monday, 18 July 2011

rowtype throws error when returning a value of a table

create a synonym for that table

executing a package method in TOAD

Declare

Variables in the package method

begin

assign the values to the IN PARAM

Call Package method by passing the paramaters

end;

example:

DECLAREi_account_update_reason_id ACCOUNT_UPDATE_REASON.account_update_reason_id%TYPE;o_account_update_reason_row ACCOUNT_UPDATE_REASON%ROWTYPE;BEGINi_account_update_reason_id:= 28;GUI_DATABASE_ACCESS. load_account_update_reason(i_account_update_reason_id,o_account_update_reason_row );END;

executing a package method in TOAD

Declare

Variables in the package method

begin

assign the values to the IN PARAM

Call Package method by passing the paramaters

end;

Wednesday, 29 June 2011

fetch the contraint name from oracle table

SELECT * FROM USER_CONSTRAINTS WHERE table_name ='ACCOUNT_STATEMENT' and constraint_name like 'CHK%';

fetch the contraint name from oracle table

SELECT * FROM USER_CONSTRAINTS WHERE table_name ='ACCOUNT_STATEMENT' and constraint_name like 'CHK%';

Tuesday, 21 June 2011

examples of Cursor FOR Loop in oracle

e.g.
SET SERVEROUTPUT ON
BEGIN
   FOR trip_record IN (SELECT bt_id_pk, bt_duration
                      FROM business_trips) LOOP
      -- implicit open/fetch occurs
      IF trip_record.bt_duration = 1 THEN
        DBMS_OUTPUT_LINE ('trip Number ' || trip_record.bt_id_pk
                        || ' is a one day trip');
      END IF;
   END LOOP; -- implicit CLOSE occurs
END;
/

Tuesday, 7 June 2011

Rename column in oracle

ALTER TABLE ACCOUNT_STATUS RENAME COLUMN delete_address_flag TO delete_history_flag;

Friday, 20 May 2011

List Of Delphi Keyboard Shortcut - Very Useful

Code Insight

Code Parameters : Ctrl-Shift-Space
Code Completion : Ctrl-Space
Code Templates : Ctrl-J

Class Completion
Class Completion : Ctrl-Shift-C
Class Nav Up Ctrl-Shift-Up
Class Nav Down Ctrl-Shift-Down

Code Browsing (D6 and above)
Symbol Browsing : Alt-Up
Browse Forward : Alt-Right
Browse Backward : Alt-Left

Message Window
Previous Message : Alt-F7
Next Message : Alt-F8

IDE Windows
Code Explorer : Ctrl-Shift-E
Project Manager : Ctrl-Alt-F11
Window List : Alt-0 (zero)
Object Inspector : F11

Debugger Windows
Event Log : Ctrl-Alt-V
Breakpoints : Ctrl-Alt-B
Watches : Ctrl-Alt-V
Threads : Ctrl-Alt-T

TODO List Window
Add TODO Item : Ctrl-Shift-T

Editing
Blocking Mode : Ctrl+O-L (line) Ctrl+O-C (column)

Debugging
Trace Into : F7
Step Over : F8
Trace to next source line : Shift-F7
Run to Cursor : F4
Run until return : Shift-F8
Program Reset : Ctrl-F2
Evaluate/Modify : Ctrl-F7
Add Watch : Ctrl-F5
Toggle Breakpoint : F5

Compiling
Compile Project : F5
Build : Ctrl-F5
Syntax Check : F5
Project Options : Ctrl-Shift-F11

Monday, 9 May 2011

A workaround to force keeping the leading 0 is to use a formula instead of a static string.

CODE
DEPTNO
10
20
30
40
SQL> select to_char(deptno,'FM000000000000000') deptno from dept;
DEPTNO
----------------
000000000000010
000000000000020
000000000000030
000000000000040

Wednesday, 4 May 2011

Creating an Index Explicitly

You can create indexes explicitly (outside of integrity constraints) using the SQL statement CREATE INDEX. The following statement creates an index named emp_ename for the ename column of the emp table:
CREATE INDEX emp_ename ON emp(ename)
      TABLESPACE users
      STORAGE (INITIAL 20K
      NEXT 20k
      PCTINCREASE 75);

Truncate Time in Date Time field in Oracle

Trunc(sysdate)

Examples of Case statement in Oracle

select a,
  case
    when b = '*' then 'star'
    when b = '+' then 'plus'
    when b = '-' then 'minus'
    else '????'
  end
from test_case_when;

Examples of Case statement in Oracle

select a,
  case
    when b = '*' then 'star'
    when b = '+' then 'plus'
    when b = '-' then 'minus'
    else '????'
  end
from test_case_when;

Tuesday, 3 May 2011

getting the application root path in windows .net

System.IO.Directory.GetParent(System.Windows.Forms.Application.ExecutablePath).ToString()