Search This Blog

Wednesday, September 27, 2017

LAST DATE OF YEAR, FIRST DAY OF YEAR, FIRST FRIDAY OF YEAR, SECOND FRIDAY OF YEAR IN ORACLE SQL


SELECT ADD_MONTHS (TRUNC (SYSDATE, 'YEAR'), 12) - 1 "LAST DATE OF YEAR"
  FROM DUAL;

SELECT TRUNC (SYSDATE, 'YEAR') "FIRST DAY OF YEAR" FROM DUAL;

SELECT NEXT_DAY (TRUNC (SYSDATE, 'YEAR'), 'FRIDAY') "FIRST FRIDAY OF YEAR"
  FROM DUAL;


SELECT NEXT_DAY (NEXT_DAY (TRUNC (SYSDATE, 'YEAR'), 'FRIDAY'), 'FRIDAY')
          "SECOND FRIDAY OF YEAR"
  FROM DUAL;

Wednesday, September 20, 2017

Create Same Table and Insert Data One Table to Another Table



Create a Table as same as another table:
create table new_table as ( select * from old_table); 
and then insert
insert into new_table ( select * from old_table);
If you want to create table without data . You can use :
create table new_table as ( select * from old_table where 1=0);

Copy Table From Database to Another Database Using Copy SQLPlus Command

Using SQLPlus copy command

SQL> COPY {FROM database | TO database | FROM database TO database} {APPEND|CREATE|INSERT|REPLACE} destination_table [(column, column, column, ...)]
USING query

example - (from any machine in your network)

SQL> copy from hr/hr@orcl to scott/tiger@orcl2 create employees_copy using 
select * from employees ;


Be carefull- SQLPlus COPY supports only the following datatypes:

    CHAR
    DATE
    LONG
    NUMBER
    VARCHAR2

Wednesday, September 6, 2017

How to make a boot able pen drive



How to make a boot able pen drive: 
cmd: diskpart
:list disk
:select disk (number of your pen drive like; 1) (Please be careful to select disk, Disk 0 is always may hard disk) 
:clean ( to format all )
:create partition primary
:active
:format fs=fat32 quick 
:assign

Tuesday, September 5, 2017

Email Validation in Oracle Apex 5

Steps...

Step 1. Create a item type as Textfield .

Step 2. Create Validation on this Textfield and select Validation>>Type >> Item Match Regular Expression.
Step 3. Then type this code in Regular Expression .Always Execute will >>No

Email Validation Expression:


^[a-zA-Z0-9][a-zA-Z0-9\.\-]{1,}@[a-zA-Z]{1}[a-zA-Z\.\-]{1,}\.{1}([a-zA-Z]{3,3}|[a-  zA-Z]{2,2}\.{1}[a-zA-Z]{2,2})$

Step 4. Give a Error Message for wrong email type. And Display Location will inline with Field and in Notification. 


It will work. I guess. 

Restrict File Upload by File Type in Oracle Apex

If you want to restrict file upload by file type/extension/format you can follow the below steps.  Goto File Browser Item --> Advanced --...