Sunday, April 3, 2016

General Ledger: There are not enough periods defined in your Calendar. Please define your future enterable periods.


OOAP0019: There are not enough periods defined in your Calendar. Please define your future enterable periods. 

This issue normally arises when you have Future Enterable Periods defined in Accounting Setup Manager more than 1.
In this scenario, define your calendar more than Future Enterable Periods
After defining the GL Calendar, when go to the Open/Close Period form not all Future Enterable periods are shown.
Solution:-
Check the number of future enterable periods defined in your Ledger:

• Responsibility: General Ledger Superuser
• Navigate: Setup> Financials > Accounting Setup Manager > Accounting Setups• Query your ledger
• Check the Number of Future Enterable Periods.
If the number of Future Enterable Periods is only set to 2, then you only can see two 'Future - Entry' periods in the Open and Close periods window.  Even though there are more than two 'Future - Entry' period existing, you only can see two here. If you change the number of future enterable periods for your set of books/ledger, General Ledger does not change additional period(s) to the Future Enterable status until you open a new period using the Open and Close Periods window.

Define next financial year periods also and try to open period now
Setup >> Financials >> Calendars >> Accounting 


Techniques on Self Motivation for Students

Are you looking for the best self motivation techniques for students? This article has some tips and techniques on self motivation for students. Read on...Teachers find it difficult to deal with students who seem to have no interest whatsoever in any thing that they do; related to academics, extra curriculum, etc. It's a difficult task to get them into action. On the part of the students, there may be a phase in life where personal or any other problems may affect your work or studies and you may simply find it hard to concentrate or undertake any activity. In such cases, you may show the classical signs of being demotivated like lack of interest or energy, constant feeling of boredom and procrastination.


At this phase, you need inspiration or motivation to gear up things and get going. So, why look for external motivation, when self motivation is one of the best and effective techniques known today. You must be wondering what are the self motivation techniques for students? Know how to motivate yourself from the following paragraphs.

Techniques on Self Motivation for Students

There are a few simple steps that will help students in motivating themselves to win. The following are the self motivation tips that you need to follow.

Dream
It is essential to have a dream goal or a dream target set before you start working towards it. You should set a target that is difficult but not impossible. However, you should dream big, as only then you will have a challenge to fulfill. Only when you have a clear idea on what you want to achieve, you can make plans to reach that goal.

Plan
Once you have set a goal, write it down or have it carved on your mind until you reach it. One of the best self motivation techniques for students is to chalk out two plans which you think will help you reach the goal (if one fails, you always have the other option). But you should try and make your plans as foolproof as possible.

Execute
You dream, you set a goal, you draw a plan and so comes execution of the plan. You have no time to waste and please do not procrastinate! Start immediately with your plan from day one! It is fine even if you begin with a small thing. This is one of the most important technique on either self motivation to lose weight or start studies.

Optimize
One of the best self motivation techniques for students is to optimize. Now in one way, you need to optimize your resources to their best use. Get along with people who have similar goals, make the best use of knowledge, put all the things that you have to best use. Secondly, have an optimistic attitude as only that is going to take you half way to success.

Reward
Who does not like a fete or a praise for the works and hard work that has been undertaken all the while. In your self motivation techniques, you need to reward yourself for every small achievement, for reaching every small goal that you had planned. Reward is still considered as one of the best and most effective motivation techniques known to man. You can indulge in your hobby for longer time, go for a party or take a small break as a celebration of your small success.

Apart from these major self motivation techniques for students, you can also look for inspirational books and biographies of successful people in the world. Secondly, you can write inspirational quotes on the chart and paste it in your room and read it for motivation. Lastly, one of the most important self motivation techniques that you should know is to never give up, no matter how difficult or hard! Because perseverance leads to success!

Good luck.
Sharique

Sunday, December 23, 2012

Revaluation in Oracle Fixed Assets


REVALUATION IN ORACLE FIXED ASSETS
 The asset cost is $10,000, the life is 5 years, and using straight-line depreciation.
In Year 2, Quarter 1 you revalue the asset using a revaluation rate of 5%.     
Then in Year 4, Quarter 1 you revalue the asset again using a revaluation rate of -10%    
Period(Yr,Qtr) Asset Cost Depreciation Exp. Acc. Depreciation Exp.       Revaluation Reserve
   
Yr1, Qtr1 10,000 500 500 0
Qtr2 10,000 500 1000 0
Qtr3 10,000 500 1500 0
Qtr4 10,000 500 2000 0
Sum   2000    
Revaluation by 10%... => Cost * 10% = 500
Reval.1 => 5% 10,500 0.00 2100 400

Period(Yr,Qtr) Asset Cost Depreciation Exp. Acc. Depreciation Exp. Revaluation Reserve
   
Yr2, Qtr1 10,500 525 2625 400
Qtr2 10,500 525 3150 400
Qtr3 10,500 525 3675 400
Qtr4 10,500 525 4200 400
Sum   2100    
Period(Yr,Qtr) Asset Cost Depreciation Exp. Acc. Depreciation Exp. Revaluation Reserve
   
Yr3, Qtr1 10,500 525 4725 400
Qtr2 10,500 525 5250 400
Qtr3 10,500 525 5775 400
Qtr4 10,500 525 6300 400
Sum   2100    
Revaluation by -10%... => Cost * -10% = -1050
Reval.1 => 5% 9,450 0.00 5670 -20
Period(Yr,Qtr) Asset Cost Depreciation Exp. Acc. Depreciation Exp. Revaluation Reserve
   
Yr4, Qtr1 9,450 472.5 6142.5 -20
Qtr2 9,450 472.5 6615 -20
Qtr3 9,450 472.5 7087.5 -20
Qtr4 9,450 472.5 7560 -20
Sum   1890    
Period(Yr,Qtr) Asset Cost Depreciation Exp. Acc. Depreciation Exp. Revaluation Reserve
   
Yr5, Qtr1 9,450 472.5 8032.5 -20
Qtr2 9,450 472.5 8505 -20
Qtr3 9,450 472.5 8977.5 -20
Qtr4 9,450 472.5 9450 -20
Sum   1890    
Retirement
0 0 0 -20
Oracle Assets Revaluation Year2, Revaluation by 10%
                                   Dr                                  Cr
Asset Cost   500  
  Revaluation Reserve   400
  Acc.Depr.Expense   100
Oracle Assets Revaluation Year4, Revaluation by -10%
                 
                                   Dr                                Cr
Revaluation Reserve 420  
Acc.Depr.Expense 630  
  Asset Cost   1050


Acc. Depre.Exp =  Existing Acc. Depre.Exp + [Existing Acc.Depr.Exp * (Revaluation Rate/100)]
Acc. Depre.Exp =  2000 + [2000 * (5/100)]

Revaluation Reserve = Existing Revaluation Reserve + (Change in Note Book Value)
Revaluation Reserve = 0 + (8400-8000)
Change in Note Book Value = [Reval1 => 10,500 - 2100] - [Asset Cost - Acc. Depre. Expense]
New Depre. Exp. = New Asset Cost[10,500]/20 
[20= Total Life * Total Quarters in Single Year]

Oracle EBS- Assets


Net Book Value = Original Cost - Accumulated Depreciation
You cannot retire an asset if it is added in current period
You cannot transfer an asset to a future period.
Gain/Loss = Proceeds of Sale - Cost of Removal - NBV + Revaluation Reserved


Asset Addition through Oracle Payables (Procure to Pay)


Wednesday, November 9, 2011

ORACLE PRIVILEGES

PRIVILEGE
"PRIVILEGE" is a type of authority to execute particular SQL statement or right access another user's objects.

Oracle define two types of privileges
  • System Privilege and
  • Object Privilege
System Privilege
Each user needs some system privilege to perform particular database operations.
You can see all system privileges by query

select privilege, name from system_privilege_map


Some Commonly used System privileges are:-



System Privilege
Capability

ALTER DATABASE
Make changes to the database

CREATE ANY INDEX

Create an index in any schema

CREATE PROCEDURE

Create a function, procedure, or package in your own schema.

CREATE SESSION

Connect to the database.

CREATE SYNONYM

Create a private synonym in your own schema.

CREATE PUBLIC SYNONYM

Create a public synonym.

CREATE VIEW
Create a view in your Schema

CREATE TABLE

Create a table in your own schema.

CREATE TABLESPACE

Create a new tablespace in the database.

CREATE USER

Create a user account/schema.

ALTER USER

Make changes to a user account/schema.

By Query Examples:-

grant create session, create table, unlimited tablespace to shariq


Here "shariq" is a Table, by above privileges Table "shariq" can connect to Database, creates table with unlimited table space.


However, you can also see how many privileges you have assigned from dba by query.
select * from session_privs;

Object Privilege
Object Privilege allow users to perform certain action on Database objects such as executing DML statements on tables.
Some Commonly used System privileges are:-

Object PrivilegeAllows a User to
SELECTPerform a select
INSERTPerform an insert
UPDATEPerform an update
DELETEPerform a delete
EXECUTEExecute a stored procedure

By Query Examples:-
grant select, insert, update on emp to sha

By above query, user "sha" can access "scott's" schema for Table emp selection, insertion as well as updation.
Connect to "sha" user
conn sha/sha

For Selection
select * from scott.emp;

For Updation 
 update scott.emp set ename = 'Sharique' where empno = 7369;

Thursday, October 6, 2011

Oracle Data Loader

Oracle Data Loader takes Data from any external file. Here I'll perform Oracle Data Loader from an excel file (CSV Format).
First make an excel file. Check the Image. Kindly save it in CSV format. I have saved the Excel File as 'Emp_Info.csv' as destination 'E:\Ex_Dir\Emp_Info.csv'
After making Excel Sheet, Connect to SysDba to make directory and also to give the privileges to any common user for read and write the directory. Mostly Scott and other Users unable to make directory and read, write it because of less priveleges.
Conn sys/oracle as Sysdba;
Create Directory EXDIR as 'E:\Ex_Dir';
You can give any name as Directory name but make sure the destination would be the same where you have saved the excel sheet like (as 'E:\Ex_Dir')
After that give the rights to any user you want.
Grant All on Directory EXDIR to Scott;
or 
GRANT READ, WRITE ON DIRECTORY EXDIR TO SCOTT;

Now Connect to Scott.
& Write the following Code.

CREATE TABLE EX_ABC
(
ID NUMBER,
FNAME VARCHAR2(20),
JOB VARCHAR2(20)
)
ORGANIZATION EXTERNAL
(
TYPE ORACLE_LOADER DEFAULT DIRECTORY EXDIR
ACCESS PARAMETERS
(
FIELDS TERMINATED BY ','
)
LOCATION ('EMP_INFO.csv'))

The Attributes should be in the same manner/format datatype like your excel sheet. 
Here (FIELDS TERMINATED BY ',')  indicates that you have made comma separated file,
LOCATION ('EMP_INFO.csv')) indicates your excel file name.

 Thank you. . .  !!
Have a Nice Day...!!!! 




Saturday, October 1, 2011

SQL Server- Encryption/Decryption (functions, procedures, triggers and views)


I have made some functions, procedures, triggers and views in SQL Server 2008 its level was encrypted by using “WITH ENCRYPTION”. I was looking to secure my functions, procedures, triggers and views secure so that no one would be able to use it.
After having some sort of working, I came to know that if the procedure or user defined function created “WITH ENCRYPTION”, there is no possible ways to decrypt it by SQL Server commands.
Well, if anyone wants to decrypt it then you will have to use the freeware “Optillect SQL Decryptor”. It will decrypt your functions, procedures, triggers and views.
Just download “Optillect SQL Decryptor” , connect it by using your desired connection and decrypt it whatever you want.
Have a nice Day..!

Thursday, July 14, 2011

Some Useful Data Dictionary VIEWS

Table spaces


dba_tablespacesuser_tablespaces 

Tablespace Quotas

dba_ts_quotas
user_ts_quotas
Data Files

dba_data_files
v$backup_datafile
v$datafile
v$datafile_copy
v$datafile_header
Free Space

dba_free_space
Segments

dba_segments
v$segment_statistics
Extents

dba_extents
Blocks

v$database_block_corruption

Groups
dba_tablespace_groups
SYSAUX Tablespace
v_$sysaux_occupants
Temp Tablespace
dba_temp_files
Undo Tablespace
dba_rollback_segs
dba_undo_extents
v$rollstat
v$undostat
Transportable Tablespaces
transport_set_violations

Saturday, June 25, 2011

Connect Oracle10g Database with DotNet Framework using C#


Namespaces


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

Button Click Event to Display Data on DataGridView


private void button1_Click(object sender, EventArgs e)
{
string connectionString = "provider=MSDAORA;data source=ORCL;user id=SCOTT;password=TIGER";
OleDbConnection myOleDbConnection = new OleDbConnection(connectionString);
OleDbDataAdapter da = new OleDbDataAdapter("select * from emp",myOleDbConnection );
DataSet ds = new DataSet();
da.Fill(ds, "emp");
dataGridView1.DataSource = ds.Tables["EMP"].DefaultView;
}


Monday, March 21, 2011

DROP TABLE - PURGE

Oracle Database 10g gives you the extra feature to drop your table and put them in the Recycle bin, This feature was introduced in 10g and it's not in earlier versions. Once you drop the table you can use Flashback query to retrieve that table from the Recycle bin.
If you want to remove the table permanently from the database also from Recycle bin then you have to use PURGE (just like shift+delete key in Windows).
And you cannot roll back Drop Table and Purge Clause.

Syntax given below.

Drop Table Table_name Purge;
It'll permanently remove and clears your storage space.

Drop Table Table_name
It will drop the table and send that table into the Recycle Bin.

Flashback Table Table_name to Before drop;
It will retrieve the Table from the Recycle Bin.

And also you can use this query to retrieve from Recycle Bin.

Select original_name, operation, droptime, from recyclebin;
Where Original_name is the table_name
Operation is drop that you did perform
Droptime, At what time you dropped the table.

To Clear the RecycleBin,
PURGE RECYCLEBIN;

Wednesday, March 2, 2011

Syed Sharique Imam: Different Types of Joins-

Syed Sharique Imam: Different Types of Joins-: "Joins A range of new join syntax are available that comply with the ANSI/ISO SQL: 1999 standards. CROSS JOIN The CROSS JOIN produces a ca..."

Tuesday, March 1, 2011

Different Types of Joins-

Joins

A range of new join syntax are available that comply with the ANSI/ISO SQL: 1999 standards.

CROSS JOIN

The CROSS JOIN produces a cartesian product.

ANSI/ISO Syntax

select e.ename, d.dname
from emp e cross join dept d;

Existing Syntax
select e.ename, d.dname
from emp e , dept d ;

NATURAL JOIN

The NATURAL JOIN performs a join for all columns with matching names in the two tables.

ANSI/ISO Syntax

select e.ename, d.dname
from emp e natural join dept d;

Existing Syntax

select e.ename, d.dname
from emp e , dept d
where e.deptno = d.deptno;

JOIN ... USING

The USING clause is used if several columns share the same name, but you do not wish to join using all of these common columns. The columns listed in the USING clause cannot have any qualifiers in the statement, including the WHERE clause.


ANSI/ISO Syntax

select e.ename, e.job, d.dname
from emp e join dept d
using (deptno)

Existing Syntax

select e.ename, e.job, d.dname
from emp e , dept d
where e.deptno = d.deptno

Multiple Joins

Multiple Joins are those where more than two tables are joined

ANSI/ISO Syntax

select first_name, last_name, department_name, city
from employees e join departments d on (e.department_id = d.department_id)
join locations l on (d.location_id = l.location_id)

Existing Syntax

select first_name, last_name, department_name, city
from employees e , departments d , locations l
where e.department_id = d.department_id
and d.location_id = l.location_id

OUTER JOIN

There are three variations on the outer join. The LEFT OUTER JOIN returns all the rows from the table on the left side of the join, along with the values from the right hand side, or NULLs if a matching row doesn't exist. The RIGHT OUTER JOIN does the reverse of this. Finally, the FULL OUTER JOIN returns all rows from both tables, filling in any blanks with nulls.


ANSI/ISO Syntax

select l.city, d.department_name
from locations l
left outer join
departments d
on (l.location_id = d.location_id)


Existing Syntax

select l.city, d.department_name
from locations l , departments d
where l.location_id = d.location_id(+)


ANSI/ISO Syntax

select l.city, d.department_name
from locations l
right outer join
departments d
on (l.location_id = d.location_id)


Existing Syntax

select l.city, d.department_name
from locations l , departments d
where l.location_id(+) = d.location_id


ANSI/ISO Syntax

select l.city, d.department_name
from locations l
full outer join
departments d
on (l.location_id = d.location_id)


Existing Syntax

No Equivalent!

Saturday, February 5, 2011

Oracle - Date Time Format

SQL> SELECT TO_CHAR (SYSDATE, 'DD-MON-RRRR HH24:MI:SS') FROM DUAL;

TO_CHAR(SYSDATE,'DD-
--------------------
01-FEB-2011 15:24:12

SQL> ED
Wrote file afiedt.buf

1* SELECT SYSDATE, 'DD-MON-RRRR HH24:MI:SS' FROM DUAL
SQL> /

SYSDATE 'DD-MON-RRRRHH24:MI:SS
--------- ----------------------
01-FEB-11 DD-MON-RRRR HH24:MI:SS


1* SELECT TO_CHAR(SYSDATE,'DD-MON-RR') FROM DUAL
SQL> /

TO_CHAR(S
---------
01-FEB-11

SQL> ED
Wrote file afiedt.buf

1* SELECT TO_CHAR(SYSDATE,'DD-MON-RR') "SYSTEM DATE" FROM DUAL
SQL> /

SYSTEM DA
---------
01-FEB-11

SQL> ED
Wrote file afiedt.buf

1* SELECT TO_CHAR(SYSDATE,'DD-MON-RR') "SYS DATE" FROM DUAL
SQL> /

SYS DATE
---------
01-FEB-11

1* SELECT SYSDATE, HIREDATE, MONTHS_BETWEEN(SYSDATE, HIREDATE) "MONTH-B/W" FROM EMP
SQL> /

SYSDATE HIREDATE MONTH-B/W
--------- --------- ----------
01-FEB-11 17-DEC-80 361.504772
01-FEB-11 20-FEB-81 359.407998
01-FEB-11 22-FEB-81 359.343482
01-FEB-11 02-APR-81 357.988643
01-FEB-11 28-SEP-81 352.149934
01-FEB-11 01-MAY-81 357
01-FEB-11 09-JUN-81 355.762837
01-FEB-11 19-APR-87 285.440256
01-FEB-11 17-NOV-81 350.504772
01-FEB-11 08-SEP-81 352.795095
01-FEB-11 23-MAY-87 284.311224
01-FEB-11 03-DEC-81 349.956385
01-FEB-11 03-DEC-81 349.956385
01-FEB-11 23-JAN-82 348.311224

14 rows selected.

SQL> ED
Wrote file afiedt.buf

1* SELECT SYSDATE, HIREDATE, ROUND(MONTHS_BETWEEN(SYSDATE, HIREDATE),0) "MONTH-B/W" FROM EMP
SQL> /

SYSDATE HIREDATE MONTH-B/W
--------- --------- ----------
01-FEB-11 17-DEC-80 362
01-FEB-11 20-FEB-81 359
01-FEB-11 22-FEB-81 359
01-FEB-11 02-APR-81 358
01-FEB-11 28-SEP-81 352
01-FEB-11 01-MAY-81 357
01-FEB-11 09-JUN-81 356
01-FEB-11 19-APR-87 285
01-FEB-11 17-NOV-81 351
01-FEB-11 08-SEP-81 353
01-FEB-11 23-MAY-87 284
01-FEB-11 03-DEC-81 350
01-FEB-11 03-DEC-81 350
01-FEB-11 23-JAN-82 348

14 rows selected.

SQL> ED
Wrote file afiedt.buf

1 SELECT SYSDATE, HIREDATE, ROUND(MONTHS_BETWEEN(SYSDATE, HIREDATE),0) "MONTH-B/W",
2* (SYSDATE-HIREDATE)/30 "MONTHSSS" FROM EMP
SQL> /

SYSDATE HIREDATE MONTH-B/W MONTHSSS
--------- --------- ---------- ----------
01-FEB-11 17-DEC-80 362 366.788296
01-FEB-11 20-FEB-81 359 364.621629
01-FEB-11 22-FEB-81 359 364.554963
01-FEB-11 02-APR-81 358 363.254963
01-FEB-11 28-SEP-81 352 357.288296
01-FEB-11 01-MAY-81 357 362.288296
01-FEB-11 09-JUN-81 356 360.988296
01-FEB-11 19-APR-87 285 289.654963
01-FEB-11 17-NOV-81 351 355.621629
01-FEB-11 08-SEP-81 353 357.954963
01-FEB-11 23-MAY-87 284 288.521629
01-FEB-11 03-DEC-81 350 355.088296
01-FEB-11 03-DEC-81 350 355.088296
01-FEB-11 23-JAN-82 348 353.388296

14 rows selected.

SQL> ED
Wrote file afiedt.buf

1 SELECT SYSDATE, HIREDATE, ROUND(MONTHS_BETWEEN(SYSDATE, HIREDATE),0) "MONTH-B/W",
2* ROUND((SYSDATE-HIREDATE)/30,0) "MONTHSSS" FROM EMP
SQL> /

SYSDATE HIREDATE MONTH-B/W MONTHSSS
--------- --------- ---------- ----------
01-FEB-11 17-DEC-80 362 367
01-FEB-11 20-FEB-81 359 365
01-FEB-11 22-FEB-81 359 365
01-FEB-11 02-APR-81 358 363
01-FEB-11 28-SEP-81 352 357
01-FEB-11 01-MAY-81 357 362
01-FEB-11 09-JUN-81 356 361
01-FEB-11 19-APR-87 285 290
01-FEB-11 17-NOV-81 351 356
01-FEB-11 08-SEP-81 353 358
01-FEB-11 23-MAY-87 284 289
01-FEB-11 03-DEC-81 350 355
01-FEB-11 03-DEC-81 350 355
01-FEB-11 23-JAN-82 348 353

14 rows selected.

SQL> ED
Wrote file afiedt.buf

1 SELECT SYSDATE, HIREDATE, ROUND(MONTHS_BETWEEN(SYSDATE, HIREDATE),0) "MONTH-B/W",
2* ROUND((SYSDATE-HIREDATE)/30,0) "MONTHSSS" FROM EMP
SQL> /

SYSDATE HIREDATE MONTH-B/W MONTHSSS
--------- --------- ---------- ----------
01-FEB-11 17-DEC-80 362 367
01-FEB-11 20-FEB-81 359 365
01-FEB-11 22-FEB-81 359 365
01-FEB-11 02-APR-81 358 363
01-FEB-11 28-SEP-81 352 357
01-FEB-11 01-MAY-81 357 362
01-FEB-11 09-JUN-81 356 361
01-FEB-11 19-APR-87 285 290
01-FEB-11 17-NOV-81 351 356
01-FEB-11 08-SEP-81 353 358
01-FEB-11 23-MAY-87 284 289
01-FEB-11 03-DEC-81 350 355
01-FEB-11 03-DEC-81 350 355
01-FEB-11 23-JAN-82 348 353

1* SELECT SYSDATE, NEXT_DAY(SYSDATE,'WEDNESDAY') FROM DUAL
SQL> /

SYSDATE NEXT_DAY(
--------- ---------
01-FEB-11 02-FEB-11

1* SELECT SYSDATE, LAST_DAY(SYSDATE) FROM DUAL
SQL> /

SYSDATE LAST_DAY(
--------- ---------
01-FEB-11 28-FEB-11

SQL> -- LAST_DAY,, RETURNS LASTDAY OF THE MONTH ----
SQL> SELECT SYSDATE, ADD_MONTHS(SYSDATE, 2) FROM DUAL;

SYSDATE ADD_MONTH
--------- ---------
01-FEB-11 01-APR-11

1* SELECT SYSDATE, ADD_MONTHS(SYSDATE, -2) FROM DUAL
SQL> /

SYSDATE ADD_MONTH
--------- ---------
01-FEB-11 01-DEC-10

SQL> SELECT '12' * 5, '01-FEB-11' FROM DUAL;

'12'*5 '01-FEB-1
---------- ---------
60 01-FEB-11

SQL> ED
Wrote file afiedt.buf

1* SELECT '12' * 5, '01-FEB-11', '3*5' FROM DUAL
SQL> /

'12'*5 '01-FEB-1 '3*
---------- --------- ---
60 01-FEB-11 3*5

SQL> ED
Wrote file afiedt.buf

1* SELECT '12' * 5, '01-FEB-11', 3*'5' FROM DUAL
SQL> /

'12'*5 '01-FEB-1 3*'5'
---------- --------- ----------
60 01-FEB-11 15

SQL> -- CONVERSION FUNCTION,,, 'IGNORES SINGLE CODE'-----
SQL> -- ALSO CALLED IMPLICIT CONVERSION --

1* select SYSDATE, TO_CHAR(SYSDATE, 'D, DD, DDD, DAY, DY, W, WWW') "FORMATS" FROM DUAL
SQL> /

SYSDATE FORMATS
--------- ----------------------------------
01-FEB-11 3, 01, 032, TUESDAY , TUE, 1, 051

SQL> ED
Wrote file afiedt.buf

1* select SYSDATE, TO_CHAR(SYSDATE, 'D, DD, DDD, DAY, DY, W, WWW') "FORMATS" FROM DUAL
SQL> /

SYSDATE FORMATS
--------- ----------------------------------
01-FEB-11 3, 01, 032, TUESDAY , TUE, 1, 051

SQL> ED
Wrote file afiedt.buf

1* select SYSDATE, TO_CHAR(SYSDATE, 'D, DD, DDD, DAY, DY, W, WWW, MM, MON, MONTH, RM') "FORMATS" FROM DUAL
SQL> /

SYSDATE FORMATS
--------- ------------------------------------------------------------
01-FEB-11 3, 01, 032, TUESDAY , TUE, 1, 051, 02, FEB, FEBRUARY , II

SQL> ed
Wrote file afiedt.buf

1* select SYSDATE, TO_CHAR(SYSDATE, 'DD-MM-RRRR SCC,CC') "FORMATS" FROM DUAL
SQL> /

SYSDATE FORMATS
--------- -----------------
01-FEB-11 01-02-2011 21,21

SQL> ED
Wrote file afiedt.buf

1* select SYSDATE, TO_CHAR(SYSDATE, 'DD-MM-RRRR SCC AD,CC B.C.') "FORMATS" FROM DUAL
SQL> /

SYSDATE FORMATS
--------- -------------------------
01-FEB-11 01-02-2011 21 AD,21 A.D.

SQL> -- TIME FORMAT---

Oracle - Number Date Functions

SQL> --------NUMBER FUNCTIONS------------
SQL> SELECT ROUND(45,923) FROM DUAL;

ROUND(45,923)
-------------
45

SQL> ED
Wrote file afiedt.buf

1* SELECT ROUND(44.569) FROM DUAL
SQL> /

ROUND(44.569)
-------------
45

SQL> ED
Wrote file afiedt.buf

1* SELECT ROUND(44.569,2) FROM DUAL
SQL> /

ROUND(44.569,2)
---------------
44.57

SQL> ED
Wrote file afiedt.buf

1 SELECT ROUND(33.987),
2 ROUND(23.569,3),
3* ROUND(94.34,2) FROM DUAL
SQL> /

ROUND(33.987) ROUND(23.569,3) ROUND(94.34,2)
------------- --------------- --------------
34 23.569 94.34

SQL> ED
Wrote file afiedt.buf

1 SELECT ROUND(33.987),
2 ROUND(23.569,1),
3* ROUND(94.34,2) FROM DUAL
SQL> /

ROUND(33.987) ROUND(23.569,1) ROUND(94.34,2)
------------- --------------- --------------
34 23.6 94.34

SQL> ED
Wrote file afiedt.buf

1* SELECT ROUND(23.569) FROM DUAL
SQL> /

ROUND(23.569)
-------------
24

SQL> ED
Wrote file afiedt.buf

1* SELECT ROUND(23.569,2) FROM DUAL
SQL> /

ROUND(23.569,2)
---------------
23.57

SQL> ED
Wrote file afiedt.buf

1* SELECT ROUND(23.569,-1), ROUND(44.569,0) FROM DUAL
SQL> /

ROUND(23.569,-1) ROUND(44.569,0)
---------------- ---------------
20 45

SQL> ED
Wrote file afiedt.buf

1* SELECT ROUND(230.569,-2), ROUND(44.569,0) FROM DUAL
SQL> /

ROUND(230.569,-2) ROUND(44.569,0)
----------------- ---------------
200 45

SQL> ED
Wrote file afiedt.buf

1* SELECT TRUNC(230.569,1), ROUND(44.569,-1) FROM DUAL
SQL> /

TRUNC(230.569,1) ROUND(44.569,-1)
---------------- ----------------
230.5 40

SQL> ED
Wrote file afiedt.buf

1* SELECT TRUNC(230.769) FROM DUAL
SQL> /

TRUNC(230.769)
--------------
230

SQL> -- TRUNC USED FOR AS IT IS PRINTING WHILE ROUND FUNCTION SIGNIFICANTS THE NUMBER------------
SQL> ED
Wrote file afiedt.buf

1* SELECT TRUNC(230.769,3) FROM DUAL
SQL> /

TRUNC(230.769,3)
----------------
230.769

SQL> SELECT MOD (8,2) FROM DUAL;

MOD(8,2)
----------
0

SQL> ED
Wrote file afiedt.buf

1* SELECT MOD (9,2) FROM DUAL
SQL> /

MOD(9,2)
----------
1

SQL> ED
Wrote file afiedt.buf

1* SELECT MOD (14,3) FROM DUAL
SQL> /

MOD(14,3)
----------
2

SQL> -- MOD FUNCTION RETURNS THE REMINDER------
SQL> --CHECK LEAP YEAR OR NOT----
SQL> SELECT MOD (2012,4) FROM DUAL;

MOD(2012,4)
-----------
0

SQL> ED
Wrote file afiedt.buf

1* SELECT MOD (2011,4) FROM DUAL
SQL> /

MOD(2011,4)
-----------
3

SQL> -- RETURNS '0' INDICATE THAT ITS A LEAP YEAR--
SQL> --- DATE FUNCTIONS -----------
SQL> SELECT SYSDATE FROM DUAL;

SYSDATE
---------
01-FEB-11

SQL> ED
Wrote file afiedt.buf

1* SELECT SYSDATE, SYSDATE + 5 FROM DUAL
SQL> /

SYSDATE SYSDATE+5
--------- ---------
01-FEB-11 06-FEB-11

SQL> ED
Wrote file afiedt.buf

1* SELECT SYSDATE, SYSDATE + 5 "AFTER 5 DAYS" FROM DUAL
SQL> /

SYSDATE AFTER 5 D
--------- ---------
01-FEB-11 06-FEB-11

SQL> ED
Wrote file afiedt.buf

1* SELECT SYSDATE, SYSDATE + 5 "AFT_5DAY" SYSDATE-'365' FROM DUAL
SQL> /
SELECT SYSDATE, SYSDATE + 5 "AFT_5DAY" SYSDATE-'365' FROM DUAL
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected


SQL> ED
Wrote file afiedt.buf

1 SELECT SYSDATE,
2 SYSDATE + 5 "AFT_5DAY",
3* SYSDATE-'365' FROM DUAL
SQL> /

SYSDATE AFT_5DAY SYSDATE-'
--------- --------- ---------
01-FEB-11 06-FEB-11 01-FEB-10

SQL> ED
Wrote file afiedt.buf

1 SELECT SYSDATE,
2 SYSDATE + 5 "AFT_5DAY",
3* SYSDATE-365 FROM DUAL
SQL> /

SYSDATE AFT_5DAY SYSDATE-3
--------- --------- ---------
01-FEB-11 06-FEB-11 01-FEB-10

SQL> ED
Wrote file afiedt.buf

1 SELECT SYSDATE,
2 SYSDATE + 5 "AFT_5DAY",
3* SYSDATE-365 "BEF_365DAY" FROM DUAL
SQL> /

SYSDATE AFT_5DAY BEF_365DA
--------- --------- ---------
01-FEB-11 06-FEB-11 01-FEB-10

SQL> ED
Wrote file afiedt.buf

1 SELECT SYSDATE,
2 SYSDATE + 5 "AFT_5DAY",
3* SYSDATE-365 "BEF_365DAY" FROM DUAL
SQL> SELECT ENAME, ENAME, SYSDATE, HIREDATE, SYSDATE-HIREDATE "EMP_DAYS TOTAL" FROM EMP;

ENAME ENAME SYSDATE HIREDATE EMP_DAYS TOTAL
---------- ---------- --------- --------- --------------
01-FEB-11
SMITH SMITH 01-FEB-11 17-DEC-80 11003.4951
ALLEN ALLEN 01-FEB-11 20-FEB-81 10938.4951
WARD WARD 01-FEB-11 22-FEB-81 10936.4951
JONES JONES 01-FEB-11 02-APR-81 10897.4951
MARTIN MARTIN 01-FEB-11 28-SEP-81 10718.4951
BLAKE BLAKE 01-FEB-11 01-MAY-81 10868.4951
CLARK CLARK 01-FEB-11 09-JUN-81 10829.4951
SCOTT SCOTT 01-FEB-11 19-APR-87 8689.49508
KING KING 01-FEB-11 17-NOV-81 10668.4951
TURNER TURNER 01-FEB-11 08-SEP-81 10738.4951
ADAMS ADAMS 01-FEB-11 23-MAY-87 8655.49508
JAMES JAMES 01-FEB-11 03-DEC-81 10652.4951
FORD FORD 01-FEB-11 03-DEC-81 10652.4951
MILLER MILLER 01-FEB-11 23-JAN-82 10601.4951

15 rows selected.

SQL> ED
Wrote file afiedt.buf

1 SELECT ENAME,
2 ENAME,
3 HIREDATE,
4* SYSDATE-HIREDATE "EMP_DAYS TOTAL" FROM EMP
SQL> /

ENAME ENAME HIREDATE EMP_DAYS TOTAL
---------- ---------- --------- --------------

SMITH SMITH 17-DEC-80 11003.4954
ALLEN ALLEN 20-FEB-81 10938.4954
WARD WARD 22-FEB-81 10936.4954
JONES JONES 02-APR-81 10897.4954
MARTIN MARTIN 28-SEP-81 10718.4954
BLAKE BLAKE 01-MAY-81 10868.4954
CLARK CLARK 09-JUN-81 10829.4954
SCOTT SCOTT 19-APR-87 8689.49544
KING KING 17-NOV-81 10668.4954
TURNER TURNER 08-SEP-81 10738.4954
ADAMS ADAMS 23-MAY-87 8655.49544
JAMES JAMES 03-DEC-81 10652.4954
FORD FORD 03-DEC-81 10652.4954
MILLER MILLER 23-JAN-82 10601.4954

15 rows selected.

SQL> ED
Wrote file afiedt.buf

1 SELECT ENAME,
2 ENAME,
3 HIREDATE,
4* ROUND(SYSDATE-HIREDATE) "EMP_DAYS TOTAL" FROM EMP
SQL> /

ENAME ENAME HIREDATE EMP_DAYS TOTAL
---------- ---------- --------- --------------

SMITH SMITH 17-DEC-80 11003
ALLEN ALLEN 20-FEB-81 10938
WARD WARD 22-FEB-81 10936
JONES JONES 02-APR-81 10897
MARTIN MARTIN 28-SEP-81 10718
BLAKE BLAKE 01-MAY-81 10868
CLARK CLARK 09-JUN-81 10829
SCOTT SCOTT 19-APR-87 8689
KING KING 17-NOV-81 10668
TURNER TURNER 08-SEP-81 10738
ADAMS ADAMS 23-MAY-87 8655
JAMES JAMES 03-DEC-81 10652
FORD FORD 03-DEC-81 10652
MILLER MILLER 23-JAN-82 10601

15 rows selected.

SQL> ED
Wrote file afiedt.buf

1 SELECT ENAME,
2 ENAME,
3 HIREDATE,
4* TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL" FROM EMP
SQL> /

ENAME ENAME HIREDATE EMP_DAYS TOTAL
---------- ---------- --------- --------------

SMITH SMITH 17-DEC-80 11003
ALLEN ALLEN 20-FEB-81 10938
WARD WARD 22-FEB-81 10936
JONES JONES 02-APR-81 10897
MARTIN MARTIN 28-SEP-81 10718
BLAKE BLAKE 01-MAY-81 10868
CLARK CLARK 09-JUN-81 10829
SCOTT SCOTT 19-APR-87 8689
KING KING 17-NOV-81 10668
TURNER TURNER 08-SEP-81 10738
ADAMS ADAMS 23-MAY-87 8655
JAMES JAMES 03-DEC-81 10652
FORD FORD 03-DEC-81 10652
MILLER MILLER 23-JAN-82 10601

15 rows selected.

SQL> ED
Wrote file afiedt.buf

1 SELECT ENAME,
2 ENAME,
3 DEPTNO,
4 HIREDATE,
5 TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL" FROM EMP
6* WHERE DEPTNO = 10
SQL> /

ENAME ENAME DEPTNO HIREDATE EMP_DAYS TOTAL
---------- ---------- ---------- --------- --------------
CLARK CLARK 10 09-JUN-81 10829
KING KING 10 17-NOV-81 10668
MILLER MILLER 10 23-JAN-82 10601

SQL> ED
Wrote file afiedt.buf

1 SELECT EMPNO,
2 ENAME,
3 JOB,
4 DEPTNO,
5 HIREDATE,
6 TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL" FROM EMP
7* WHERE DEPTNO = 10
SQL> /

EMPNO ENAME JOB DEPTNO HIREDATE EMP_DAYS TOTAL
---------- ---------- --------- ---------- --------- --------------
7782 CLARK MANAGER 10 09-JUN-81 10829
7839 KING PRESIDENT 10 17-NOV-81 10668
7934 MILLER CLERK 10 23-JAN-82 10601

SQL> ED
Wrote file afiedt.buf

1 SELECT EMPNO,
2 ENAME,
3 JOB,
4 DEPTNO,
5 HIREDATE,
6 TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL",
7 (SYSDATE-HIREDATE)/30
8 FROM EMP
9* WHERE DEPTNO = 10
SQL> /

EMPNO ENAME JOB DEPTNO HIREDATE EMP_DAYS TOTAL (SYSDATE-HIREDATE)/30
---------- ---------- --------- ---------- --------- -------------- ---------------------
7782 CLARK MANAGER 10 09-JUN-81 10829 360.983443
7839 KING PRESIDENT 10 17-NOV-81 10668 355.616777
7934 MILLER CLERK 10 23-JAN-82 10601 353.383443

SQL> ed
Wrote file afiedt.buf

1 SELECT EMPNO,
2 ENAME,
3 JOB,
4 DEPTNO,
5 HIREDATE,
6 TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL",
7 TRUNC((SYSDATE-HIREDATE)/30) "NO_MONTHS"
8 FROM EMP
9* WHERE DEPTNO = 10
SQL> /

EMPNO ENAME JOB DEPTNO HIREDATE EMP_DAYS TOTAL NO_MONTHS
---------- ---------- --------- ---------- --------- -------------- ----------
7782 CLARK MANAGER 10 09-JUN-81 10829 360
7839 KING PRESIDENT 10 17-NOV-81 10668 355
7934 MILLER CLERK 10 23-JAN-82 10601 353

SQL> ED
Wrote file afiedt.buf

1 SELECT EMPNO,
2 ENAME,
3 JOB,
4 DEPTNO,
5 HIREDATE,
6 TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL",
7 TRUNC((SYSDATE-HIREDATE)/12) "NO_YEARS",
8 TRUNC((SYSDATE-HIREDATE)/30) "NO_MONTHS"
9 FROM EMP
10* WHERE DEPTNO = 10
SQL> /

EMPNO ENAME JOB DEPTNO HIREDATE EMP_DAYS TOTAL NO_YEARS NO_MONTHS
---------- ---------- --------- ---------- --------- -------------- ---------- ----------
7782 CLARK MANAGER 10 09-JUN-81 10829 902 360
7839 KING PRESIDENT 10 17-NOV-81 10668 889 355
7934 MILLER CLERK 10 23-JAN-82 10601 883 353

SQL> ED
Wrote file afiedt.buf

1 SELECT EMPNO,
2 ENAME,
3 JOB,
4 DEPTNO,
5 HIREDATE,
6 TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL",
7 TRUNC((SYSDATE-HIREDATE)/365) "NO_YEARS",
8 TRUNC((SYSDATE-HIREDATE)/30) "NO_MONTHS"
9 FROM EMP
10* WHERE DEPTNO = 10
SQL> /

EMPNO ENAME JOB DEPTNO HIREDATE EMP_DAYS TOTAL NO_YEARS NO_MONTHS
---------- ---------- --------- ---------- --------- -------------- ---------- ----------
7782 CLARK MANAGER 10 09-JUN-81 10829 29 360
7839 KING PRESIDENT 10 17-NOV-81 10668 29 355
7934 MILLER CLERK 10 23-JAN-82 10601 29 353

SQL> ED
Wrote file afiedt.buf

1 SELECT EMPNO,
2 ENAME,
3 JOB,
4 DEPTNO,
5 HIREDATE,
6 TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL",
7 TRUNC((SYSDATE-HIREDATE)/365) "NO_YEARS",
8 TRUNC((SYSDATE-HIREDATE)/30) "NO_MONTHS"
9 FROM EMP
10* WHERE DEPTNO = 10
SQL> SELECT * FROM EMP;

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
111 BB 122
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10

15 rows selected.

SQL> DELETE empno = 111
2 ;
DELETE empno = 111
*
ERROR at line 1:
ORA-00933: SQL command not properly ended


SQL> DELETE EMP WHERE EMPNO = 111;

1 row deleted.

SQL> SELECT * FROM EMP;

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10

14 rows selected.

SQL> SELECT EMPNO,
2 ENAME,
3 JOB,
4 DEPTNO,
5 HIREDATE,
6 TRUNC(SYSDATE-HIREDATE) "EMP_DAYS TOTAL",
7 TRUNC((SYSDATE-HIREDATE)/365) "NO_YEARS",
8 TRUNC((SYSDATE-HIREDATE)/30) "NO_MONTHS"
9 FROM EMP
10 WHERE DEPTNO = 10
11 /

EMPNO ENAME JOB DEPTNO HIREDATE EMP_DAYS TOTAL NO_YEARS NO_MONTHS
---------- ---------- --------- ---------- --------- -------------- ---------- ----------
7782 CLARK MANAGER 10 09-JUN-81 10829 29 360
7839 KING PRESIDENT 10 17-NOV-81 10668 29 355
7934 MILLER CLERK 10 23-JAN-82 10601 29 353