Undo in Oracle forms

A good way to enable user to undo last changes , I  found it by Mr. GERD blog.
,,
Retrieving data from the database and changing the data is really easy. But what, if the user changes data and want to do an UNDO?

Doing a new query is the easiest way. The limitations are:

- in a multi-record-block you have to position in the correct record after the query
- if the query was executed via ENTER-QUERY mode you can't jump to the old record because the query-result has changed.

So you have to use a new technique.

The solution is this function. All database-items get their old values back:
PROCEDURE Undo IS
  V_Block  VARCHAR2 (30) := :SYSTEM.CURSOR_BLOCK;
  V_Field  VARCHAR2 (61);
  V_Item   VARCHAR2 (61);
BEGIN
  Validate (Item_Scope);
  IF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
    V_Field := Get_Block_Property (V_Block, FIRST_ITEM);
    V_Item := V_Block || '.' || V_Field;
    WHILE V_Field IS NOT NULL
    LOOP
      IF Get_Item_Property (V_Item, ITEM_TYPE) 
         IN ('DISPLAY ITEM', 'CHECKBOX', 'LIST', 
             'RADIO GROUP',  'TEXT ITEM')
      AND Get_Item_Property (V_Item, BASE_TABLE) = 'TRUE' 
      THEN
        COPY (Get_Item_Property (V_Item, DATABASE_VALUE), 
              V_Item);
      END IF;
      V_Field := Get_Item_Property (V_Item, NextItem);
      V_Item := V_Block || '.' || V_Field;
    END LOOP;
  END IF;
END;
Best practice is to start this undo-procedure from a menu (e.g. EDIT - UNDO) or handle it through a shortcut. ,,

Multi-Select from DUAL

Here's a hidden trick inside SQL .
,,
An easy way to generate records from scratch is using an easy CONNECT BY against DUAL.

e.g. you need a Forms-LOV which shows the last 12 months.
So you have to create a record-group-select which gives you exactly 12 records. After that you combine it with sysdate. Let's see:
 SELECT Level LVL
   FROM Dual
CONNECT BY Level <= 12;

then you integrate the sysdate into the statement:


 SELECT add_months (trunc (sysdate, 'MM'), -1*Level) Month
   FROM Dual
CONNECT BY Level <= 12;    ,,

Thanks to
 

copy all files and folders using CMD

Copying files from one folder to another , may be hard for permissions or when using security software.



I found the following method to  copy   all files and subfolders too from one place to an other ,  using  command prompt.



XCOPY D:\Source_Folder    F:\Destination_Folder /h/i/c/k/e/r/y



I recommend using this method as it's really very fast  and ram non-consuming 



Source : StackOverFlow

ORACLE ly

My blogspot name  was generated automatically using Shopify .

Get highest 3 salary in Oracle 10g


Hello and Welcome back.







This is my first blog since I returned  to Egypt  as I was working in KSA for year and half.







Here's how to get the highest three salaries in HR Schema using SQL.







# Old method was using ROWNUM , but it's not accurate  because it returns the first 3 rows only using the following code :



SELECT   *



  FROM   (  SELECT   last_name, salary



              FROM   employees



          ORDER BY   salary DESC)



 WHERE   ROWNUM <= 3



here's what you  get :





















LAST_NAME SALARY
King 24,000
Kochhar 17,000
De Haan 17,000




But  using an other method using Dense_Rank() Over , returns results more accurate.


Here's the code:



SELECT   *


  FROM   (SELECT   last_name, salary,


                   DENSE_RANK () OVER (ORDER BY salary DESC) top_rank


            FROM   employees)


 WHERE   top_rank <= 3



here's what you get :































LAST_NAME SALARY TOP_RANK
King 24,000 1
Kochhar 17,000 2
De Haan 17,000 2
Russell 14,000 3



Thanks for  CodeProject Site


LogMeIn XP install bugs , how to fix !








The official LogmeIn installer for windows XP and server 2003  does not  work.





The old  installer worked perfect , you can download it from here..





But after installing LogMeIn on Windows Server 2003 , I got Your Computer Offline error .





Me and my friend Nouh  could fix it by the following steps :


# open Internet Explorer -


# goto Tools - Advanced 


# scroll to the end of it 


# enable TLS 1.0  


# disbale  SSL 3.0.


you're done !











Accessing your Virtualbox Guest from your Host OS

  1. If your guest machine is running, shut it down first.

  2. Click on File->Preferences in the VirtualBox menu-bar.
    screenshot-vbox-menubar

  3. Select the Network option from the side menu and click on the Host-only networks tab.
    screenshot-vbox-host-only-network-add-new

  4. The default options for the newly-created Host-only network should be fine. If not, you can add the following data manually, by clicking on the Edit button in the DHCP Server tab.
    • Server Address: 192.168.56.100

    • Server Mask: 255.255.255.0

    • Lower Address Bound: 192.168.56.101

    • Upper Address Bound: 192.168.56.254

    Don't forget to check the Enable Server option.
    screenshot-vbox-host-only-network-edit
    screenshot-vbox-host-only-network-dhcp-settings

  5. Now save all the settings in Preferences.

  6. Now open up the settings of your Guest machine and navigate to the Network option from the side menu and click on the Adapter 2 tab.
    screenshot-vbox-guest-settings
    screenshot-vbox-guest-settings-network-

  7. In the Attached to section, click on the dropdown and choose Host-only Adapter and in the Name section nested in it, choose the newly-created Host-only network.
    Don't forget to check the Enable Network Adapter option.
    screenshot-vbox-guest-network-adapter

  8. Save these settings and boot into your Guest machine.

  9. After logging in, type ifconfig. Note the new IP, it should be under a new interface like eth0 or vboxnet0. Now you can use this IP to SSH, view the webpages on your machine's Apache Server, etc..

Thanks to  2Ubuntu

Remove unused Layouts in Oracle Apex

 Tables used : APEX_XXXXXXX.WWV_FLOW_REPORT_LAYOUTS APEX_XXXXXXX.WWV_FLOW_SHARED_QUERIES use the following query to delete unused Layouts. ...