This adobe photoshop 7.0 tutorial teaches you to design a nice looking desert texture.
Create a new file of your choice. Fill the background with #AC926D.
Apply noise filter (Filter>Noise>Add Noise) with amount set to 3%
Select line tool, set weight to 3 pixel and draw some lines selecting #806C47 as foreground color.
Group and merge the lines. Add 7.4% noise in this layer.
Now, go to filter>distort>Twirl selecting angle to 65.
Press control+j to duplicate the layer. Select Smudge Tool. Set the mode to Darken, Strength to 40% & brush size to 100 px. Drag the brush over the layer until you get something like this :-
Finally, change the layer style to Soft Light and reduce the opacity to 67%. Our desert texture is ready :)
Monday, July 16, 2007
Friday, July 13, 2007
Monday, July 9, 2007
The dual Table
The dual Table
1. dual is a table that contains a single row.
2. The dual table has one VARCHAR2 column named dummy.
3. dual contains a single row with the value X.
The structure of the dual table:
SQL>
SQL> DESCRIBE dual;
Name Null? Type
DUMMY VARCHAR2(1)
SQL> SELECT * FROM dual;
D
-
X
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Understanding Null Values
1. A database use null value to represent a unknown value.
2. A null value is not a blank string.
3. A null value means the value for the column is unknown.
4. When you select a column that contains a null value, you see nothing in that column.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1. dual is a table that contains a single row.
2. The dual table has one VARCHAR2 column named dummy.
3. dual contains a single row with the value X.
The structure of the dual table:
SQL>
SQL> DESCRIBE dual;
Name Null? Type
DUMMY VARCHAR2(1)
SQL> SELECT * FROM dual;
D
-
X
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Understanding Null Values
1. A database use null value to represent a unknown value.
2. A null value is not a blank string.
3. A null value means the value for the column is unknown.
4. When you select a column that contains a null value, you see nothing in that column.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Oracle --- Getting the difference between Dates
Getting the difference between Dates
Frequently we are asked -- how can I find the number of minutes between two dates or what is the amount of elapsed time. With Oracle Dates, this is pretty trivial, you can get either TOTAL (days, hours, minutes, seconds) between 2 dates simply by subtracting them or with a little mod'ing you can get Days/Hours/Minutes/Seconds between.
For example:
SQL> set serveroutput on
SQL>
SQL> declare
2 a date;
3 b date;
4 begin
5 a := sysdate;
6 dbms_lock.sleep(10); -- sleep about 10 seconds give or take
7 b := sysdate;
8
9 dbms_output.put_line( b-a || ' of a day has elapsed' );
10 dbms_output.put_line( (b-a)*24 || ' of an hour has elapsed' );
11 dbms_output.put_line( (b-a)*24*60 || ' of a minute has elapsed' );
12 dbms_output.put_line( (b-a)*24*60*60 || ' seconds has elapsed' );
13 end;
14 /
.000127314814814814814814814814814814814815 of a day has elapsed
.00305555555555555555555555555555555555556 of an hour has elapsed
.1833333333333333333333333333333333333336 of a minute has elapsed
11.00000000000000000000000000000000000002 seconds has elapsed
PL/SQL procedure successfully completed.
To break the diff between 2 dates into days, hours, minutes, sec -- you can use the following:
select to_char( created, 'dd-mon-yyyy hh24:mi:ss' ),
trunc( sysdate-created ) "Dy",
trunc( mod( (sysdate-created)*24, 24 ) ) "Hr",
trunc( mod( (sysdate-created)*24*60, 60 ) ) "Mi",
trunc( mod( (sysdate-created)*24*60*60, 60 ) ) "Sec",
to_char( sysdate, 'dd-mon-yyyy hh24:mi:ss' ),
sysdate-created "Tdy",
(sysdate-created)*24 "Thr",
(sysdate-created)*24*60 "Tmi",
(sysdate-created)*24*60*60 "Tsec"
from all_users
where rownum < 50
/
Dy gives you number of days between 2 dates (partial days discarded). Tdy gives you total days including fractions (eg: you'll get 1.5 for 1 and 1/2 days). Likewise for HR and THR and so on.
Sybase users are used to using datediff in the database and are many times baffled by the lack of a function to do date arithemetic that they assume Oracle cannot do it. It is really just that date arithmetic is so trivial that a specialized function like datediff is not needed. Just subtract. You get the difference in days. Multiply by 24 -- hours, multiply by 60 minutes, multiply by 60 -- seconds.
If you really want 'datediff' in your database, you can just do something like this:
SQL> create or replace function datediff( p_what in varchar2,
2 p_d1 in date,
3 p_d2 in date ) return number
4 as
5 l_result number;
6 begin
7 select (p_d2-p_d1) *
8 decode( upper(p_what),
9 'SS', 24*60*60, 'MI', 24*60, 'HH', 24, NULL )
10 into l_result from dual;
11
11 return l_result;
12 end;
13 /
Function created
Now, i just create a view to demonstrate with:
SQL> create or replace view temp_view
2 as
3 select to_date('01-JAN-1999 12:02:04', 'dd-mon-yyyy hh24:mi:ss' ) d1,
4 to_date('15-MAR-1999 01:34:23', 'dd-mon-yyyy hh24:mi:ss' ) d2
5 from dual
6 /
View created.
SQL> select datediff( 'ss', d1, d2 ) seconds from temp_view;
SECONDS
----------
6269539
SQL> select datediff( 'mi', d1, d2 ) minutes from temp_view;
MINUTES
----------
104492.317
SQL> select datediff( 'hh', d1, d2 ) hours from temp_view;
HOURS
----------
1741.53861
Frequently we are asked -- how can I find the number of minutes between two dates or what is the amount of elapsed time. With Oracle Dates, this is pretty trivial, you can get either TOTAL (days, hours, minutes, seconds) between 2 dates simply by subtracting them or with a little mod'ing you can get Days/Hours/Minutes/Seconds between.
For example:
SQL> set serveroutput on
SQL>
SQL> declare
2 a date;
3 b date;
4 begin
5 a := sysdate;
6 dbms_lock.sleep(10); -- sleep about 10 seconds give or take
7 b := sysdate;
8
9 dbms_output.put_line( b-a || ' of a day has elapsed' );
10 dbms_output.put_line( (b-a)*24 || ' of an hour has elapsed' );
11 dbms_output.put_line( (b-a)*24*60 || ' of a minute has elapsed' );
12 dbms_output.put_line( (b-a)*24*60*60 || ' seconds has elapsed' );
13 end;
14 /
.000127314814814814814814814814814814814815 of a day has elapsed
.00305555555555555555555555555555555555556 of an hour has elapsed
.1833333333333333333333333333333333333336 of a minute has elapsed
11.00000000000000000000000000000000000002 seconds has elapsed
PL/SQL procedure successfully completed.
To break the diff between 2 dates into days, hours, minutes, sec -- you can use the following:
select to_char( created, 'dd-mon-yyyy hh24:mi:ss' ),
trunc( sysdate-created ) "Dy",
trunc( mod( (sysdate-created)*24, 24 ) ) "Hr",
trunc( mod( (sysdate-created)*24*60, 60 ) ) "Mi",
trunc( mod( (sysdate-created)*24*60*60, 60 ) ) "Sec",
to_char( sysdate, 'dd-mon-yyyy hh24:mi:ss' ),
sysdate-created "Tdy",
(sysdate-created)*24 "Thr",
(sysdate-created)*24*60 "Tmi",
(sysdate-created)*24*60*60 "Tsec"
from all_users
where rownum < 50
/
Dy gives you number of days between 2 dates (partial days discarded). Tdy gives you total days including fractions (eg: you'll get 1.5 for 1 and 1/2 days). Likewise for HR and THR and so on.
Sybase users are used to using datediff in the database and are many times baffled by the lack of a function to do date arithemetic that they assume Oracle cannot do it. It is really just that date arithmetic is so trivial that a specialized function like datediff is not needed. Just subtract. You get the difference in days. Multiply by 24 -- hours, multiply by 60 minutes, multiply by 60 -- seconds.
If you really want 'datediff' in your database, you can just do something like this:
SQL> create or replace function datediff( p_what in varchar2,
2 p_d1 in date,
3 p_d2 in date ) return number
4 as
5 l_result number;
6 begin
7 select (p_d2-p_d1) *
8 decode( upper(p_what),
9 'SS', 24*60*60, 'MI', 24*60, 'HH', 24, NULL )
10 into l_result from dual;
11
11 return l_result;
12 end;
13 /
Function created
Now, i just create a view to demonstrate with:
SQL> create or replace view temp_view
2 as
3 select to_date('01-JAN-1999 12:02:04', 'dd-mon-yyyy hh24:mi:ss' ) d1,
4 to_date('15-MAR-1999 01:34:23', 'dd-mon-yyyy hh24:mi:ss' ) d2
5 from dual
6 /
View created.
SQL> select datediff( 'ss', d1, d2 ) seconds from temp_view;
SECONDS
----------
6269539
SQL> select datediff( 'mi', d1, d2 ) minutes from temp_view;
MINUTES
----------
104492.317
SQL> select datediff( 'hh', d1, d2 ) hours from temp_view;
HOURS
----------
1741.53861
Oralce -- Add date
++++++++++++++++++++++++++++++++++++++++++++++++
Adding two months to current date
SQL> -- Adding two months to SYSDATE.
SQL> SELECT ADD_MONTHS(SYSDATE,2) from DUAL;
ADD_MONTH
---------
31-OCT-06
++++++++++++++++++++++++++++++++++++++++++++++++
Subtract Month from a given date
SQL> SELECT TO_CHAR(SYSDATE, 'ddMONyyyy') Today,
2 TO_CHAR(ADD_MONTHS(SYSDATE, 3), 'ddMONyyyy') "+ 3 mon",
3 TO_CHAR(ADD_MONTHS(SYSDATE, -23), 'ddMONyyyy') "- 23 mon"
4 FROM dual;
TODAY + 3 mon - 23 mon
--------- --------- ---------
30AUG2006 30NOV2006 30SEP2004
++++++++++++++++++++++++++++++++++++++++++++++++
Adding two months to current date
SQL> -- Adding two months to SYSDATE.
SQL> SELECT ADD_MONTHS(SYSDATE,2) from DUAL;
ADD_MONTH
---------
31-OCT-06
++++++++++++++++++++++++++++++++++++++++++++++++
Subtract Month from a given date
SQL> SELECT TO_CHAR(SYSDATE, 'ddMONyyyy') Today,
2 TO_CHAR(ADD_MONTHS(SYSDATE, 3), 'ddMONyyyy') "+ 3 mon",
3 TO_CHAR(ADD_MONTHS(SYSDATE, -23), 'ddMONyyyy') "- 23 mon"
4 FROM dual;
TODAY + 3 mon - 23 mon
--------- --------- ---------
30AUG2006 30NOV2006 30SEP2004
++++++++++++++++++++++++++++++++++++++++++++++++
oracle _ use INTERVAL function.
INTERVAL function.
This function Subtracts one datetime from another and generates the result.
When you add or subtract one interval from another, the result
is always another interval. You can multiply or divide an interval
by a numeric constant.
e.g.1
SELECT sysdate - INTERVAL '8' MONTH FROM DUAL;
Returns the following result:
SYSDATE-I
---------
28-JUL-00
e.g.2
SELECT sysdate - INTERVAL '8' day FROM DUAL;
Returns the following result:
SYSDATE-I
---------
20-MAR-01
e.g.3
SELECT sysdate - INTERVAL '8' year FROM DUAL;
Returns the following result:
SYSDATE-I
---------
28-MAR-93
OR
you can directly subtract one date from another to get difference but you need to
multiply or divide by a proper numeric constant.
Hope this will solve your problem
++++++++++++++++
By subtracting two dates, you will get the difference in days. For example,
system@dev815nt.us> l
1 select sysdate - to_date('01/01/2001','mm/dd/yyyy') days
2* from dual
system@dev815nt.us> /
DAYS
----------
86.3983333
++++++++++++++++
You could use the months_between function
for example
select months_between(sysdate,'12-aug-00') from dual;
This function Subtracts one datetime from another and generates the result.
When you add or subtract one interval from another, the result
is always another interval. You can multiply or divide an interval
by a numeric constant.
e.g.1
SELECT sysdate - INTERVAL '8' MONTH FROM DUAL;
Returns the following result:
SYSDATE-I
---------
28-JUL-00
e.g.2
SELECT sysdate - INTERVAL '8' day FROM DUAL;
Returns the following result:
SYSDATE-I
---------
20-MAR-01
e.g.3
SELECT sysdate - INTERVAL '8' year FROM DUAL;
Returns the following result:
SYSDATE-I
---------
28-MAR-93
OR
you can directly subtract one date from another to get difference but you need to
multiply or divide by a proper numeric constant.
Hope this will solve your problem
++++++++++++++++
By subtracting two dates, you will get the difference in days. For example,
system@dev815nt.us> l
1 select sysdate - to_date('01/01/2001','mm/dd/yyyy') days
2* from dual
system@dev815nt.us> /
DAYS
----------
86.3983333
++++++++++++++++
You could use the months_between function
for example
select months_between(sysdate,'12-aug-00') from dual;
Subscribe to:
Posts (Atom)