Monday, August 24, 2009

Format Model Modifiers - FX and FM

The FM and FX modifiers are used in the TO_CHAR function in oracle sql in the format model. These two modifiers control blank padding and exact format checking.

FM:
FM is fill mode. If we simply use TO_CHAR function that is without FM then Oracle uses blank characters to fill format elements to a constant width equal to the largest element for the relevant format model in the current session language. For example if NLS_LANGUAGE is set to AMERICAN then, in case of month the highest length month is SEPTEMBER. So if we don't use FM modifier then every month takes the length of 9 characters. (that is month SEPTEMBER). But if we use FM format model modifiers then the blank characters are suppressed.

Below example will clear you.

SQL> select to_char(SYSDATE,'fmDDTH MONTH YYYY') from dual;

TO_CHAR(SYSDATE,'FM
-------------------
24TH AUGUST 2009

SQL> select to_char(SYSDATE,'DDTH MONTH YYYY') from dual;

TO_CHAR(SYSDATE,'DD
-------------------
24TH AUGUST 2009

SQL> show parameter nls_language

NAME TYPE VALUE
------------------------------------ ----------- ---------------
nls_language string AMERICAN

SQL> select to_char(SYSDATE,'Day')||' Time' from dual;

TO_CHAR(SYSDAT
--------------
Monday Time
SQL> select to_char(SYSDATE,'fmDay')||' Time' from dual;

TO_CHAR(SYSDAT
--------------
Monday Time


FX:
FX is format exact.
FX modifier specifies exact matching for the character argument and datetime format model of a TO_DATE function.

Let's have a look at FX format model specification.
- Punctuation and quoted text in the character argument must exactly match the corresponding parts of the format model.

- The character argument cannot have extra blanks. Without FX, Oracle ignores
extra blanks.

- Numeric data in the character argument must have the same number of digits as
the corresponding element in the format model. Without FX, numbers in the
character argument can omit leading zeroes.

When FX is enabled, you can disable this check for leading zeroes by using the FM
modifier as well.

If any portion of the character argument violates any of these conditions, then Oracle returns an error message.

Peter Davies' Internet Marketing Blog, a student of Alex Jeffreys

This review is a summary of what Interactive Blogger, an internet marketing blog owned by Peter Davies. Peter has started and an Internet Marketing Business and is being mentored by a rising star in the Online world, Alex Jeffreys who has a great record of coaching newbies in internet marketing or those who have been struggling and don’t know where to go next. Alex in turn has been mentored by Rich Schefren whom Peter has also had the benefit of.

Alex communicates to his student the ethos of providing large amounts of value up front, so that anyone who has an online business or is thinking of creating an online business can receive great tangible benefits.

He sees internet marketing as a few simple steps;
  • First you build a blog with which you create great content to market with your readership, never try to direct sell to them

  • Use the blog to drive traffic to your site, add valuable information to other blogs, market yourself using several techniques, articles, video marketing, forums

  • Use to your traffic to build a list but don’t always try to sell to that list, give them large amounts of useful content first the sales will come later.


  • Peters’ approach has embraced Alex’s ethos, indeed he has decided as his first real venture to create a free product explaining through the eyes of someone who has recently gone through the process himself he has started a new online business from scratch. This is not a product that will get you rich overnight, he states quite clearly that there is no such thing, this covers the basics of planning, building the blog then blogging, generating traffic and building a subscriber list.

    This is a reflection of a genuine approach to getting started, watching him learn new things then apply them and watching him develop into an authority in his chosen field without the hype. Best of all its free! http://interactive-blogger.com

    Related Documents
    http://arjudba.blogspot.com/2008/08/list-of-available-advertising-network.html
    http://arjudba.blogspot.com/2009/06/how-to-get-targeted-backlinks-to-your.html
    http://arjudba.blogspot.com/2009/08/how-to-increase-your-technorati.html

    Tuesday, August 18, 2009

    List of freelancing job sites

    After the fallen of the global economy, many companies has been closed and much employees have been laid off. Some of these employees search for immediate work for living and go through various sites on internet to get work. Also most small and medium sized businesses search for freelancing sites in order to complete their works to lower cost. If a company keep a permanent employee, company has to pay like $5000~$6000 to an employee per month but through freelancing site company can hire a freelancer on demand work or per hour work basis which greatly will minimize the total cost of the company.

    In other hand, many freelancers like to do freelancing instead of regular jobs because they love to work from home. You don't have to face traffic zam, don't need to wait for bus, don't want to do some boring office works from 9 to 5pm and most importantly as a freelancer you have total freedom to choose what type of works you actually like to do.

    There are tons of sites in the Internet offering a repository of freelancing jobs. You can get service as well as provide service through those sites. Buyers post projects through the sites, coder bid on the projects, buyer select a coder based upon rating, experience and bid, after coder is select, coder will be responsible to complete the project. Upon work is accepted by the buyer coder can be paid. All the freelancing sites follow these rules. There is an escrow system before coder started to work so that there exists no scam.

    Besides some legitimate sites, there are tons of scam sites as well. So before doing freelancing tasks you need to aware of the good freelancing sites. In general, the sites where it asks money before doing registration normally they are scam sites. After analysis to various sites I am listing the best freelancing sites here.

    1)Elance.com (USA, founded in 1998):
    Elance.com is the largest online freelance site. If you want to do large professional job then elance.com is the best choice. Unlike other freelancing sites, elance.com charges freelance providers while posting the job in the list. So, it is very trusted one and posts are not fake. While in some freelancing sites there is much fake posting and bidders bid on those project but lastly provider cancel the project. So no waste of time from freelancers.

    2)GetAFreelancer.com (Sweden, started in February 2004):
    GetAFreelaner.com gets huge traffic compared to others because of it's posting flexibility. You can find freelance coders, writers, programmers, designers, marketers and more. But still the site needs to make much improvement as I see several bugs there. Besides they have several limitations and bad features like pop up windows while bidding or editing post. The great limitation is their support system is really worst.

    3)ScriptLance (Canada, started in 2001):
    Provides a service that helps businesses find freelance programmers and designers for their projects. This site has the lowest fees. It has no recurring fees, no project posting fees. Webmaster/Programmer will have to pay per project fee at the point of project acceptance (when webmaster had selected a programmer for the project and programmer accepted the project). It is your best choice if you want really cheap coding.

    4)Rent-a-coder (USA, started in 2001):
    Rent-a-coder may also be your choice but it has several limitations. As posting project is totally free so freelancers sometimes waste much time while bidding a project that is going to cancel. When you get a project done through Rentacoder you put the entire project fees into an escrow account. You don't release the fees until the project is complete. From my experience I see Rent-a-coder is biased to seller. So upon completion of your work you may not get your money. But it is really good for buyers(software providers). Another limitation of them is they are not good who have really slow internet and sites become down often. So you may not submit your tasks within the site in time and any off -site communication means they will not pay you.

    5)Guru.com (USA, started August 2000):
    According to Guru.com, it is one of the leader in freelancing industry with more than 1 million registered members and 100,000 active freelancer profiles. By using SafePay Escrow, Employers are guaranteed 100% satisfaction with their project results. They have some innovative features, such as an online Video Profile, give Freelancers a cutting edge platform to highlight their skills and experience to attract new business and retain repeat customers.

    6)GetACoder.com: (USA, UK, Hong Kong, Portugal):
    It was one of the good site in the freelancing sites. Now they rather go much for advertisement instead of freelancing. Still you can use them. According to them. When you use GetACoder you are stretching your budget and saving as much as 60% over traditional outsourcing. GetACoder is changing business, now it's no longer about what you own or build but which resources and talent you can access. With GetACoder you reduce expenses, increase efficiencies, aggressively grow your business, and create a sustainable competitive advantage.

    Other Sites in terms of less popular
    1) ifreelance
    "Post your project today to receive bids from 100's of professional service providers. When bidders compete for your project, you save time and money. It's quick and easy and best of all, it's free."

    2) Freelance-Work
    "Freelance Work was created to connect freelance and contract professionals with qualified employers. Through our project and job seeker databases, freelancers can find their next great projects and list their qualifications so employers can immediately find them."

    3) Scriptlance
    "Connecting businesses with programmers."

    4) ProjectSpring
    "Connecting Programmers with Custom Software Buyers & WebMasters."

    5) Freelance Job Search
    "New Jobs Updated 8 times an hour from every major freelance job site on the interwebs."

    6) Contracted Work
    "Find Professionals Fast, Easy & Free."

    7) Freelance Auction
    "Freelance Auction Marketplace to buy/sell freelance website services Web Design, Graphic Design, CGI, PHP, Perl, Java, XML, ASP, SQL, MYSQL Programming Script Installation, Custom Website Design, Templates, Software Development, CGI/PHP Scripts Post a quote request from freelancers or join as a freelancer, developer, contractor to bid on work"

    8) Power Lance
    "Our goal is to connect professional freelancers to webmasters providing both freelancers and webmasters the opportunity to expand their business and reduce their costs. Feel free to post a project for bidding or bid on current open projects."

    9) Freelancers
    "Freelancers.net has been helping freelancers find work and clients find freelancers since 1999. Freelancers.net is UK focused and lists many jobs and projects open to UK freelancers, however clients from across the globe use Freelancers.net regularly to source freelancers outside of the UK."

    10) Project4hire
    "Find Freelance Web Designers for Custom Web Design, Graphic Designers, Programmers, Coders, Writers and more
    Project4Hire.com is the place to find Freelance Programmers, Web Designers, Graphic Artists, IT Professionals, Translators, Writers, Consultants & other Freelance Professionals."

    11) Macfreelancer
    "Project outsourcing. Simplified."

    12) Onforce
    "OnForce is the trusted nationwide network of over 13,000 highly-skilled service professionals, available when and where you need them."

    13) Freelanza
    "Freelanza.co.za is an online outsource portal for professionals. Clients may outsource work to the available service providers by means of posting jobs on the notice board. Jobs will be awarded by the clients, to providers as they see fit. "

    14) Agentsolo
    "experts for your projects"

    15) Peopleperhour
    "Outsource Your Work To Rated Freelancers
    Save cost by using freelancers and home workers
    Stay flexible by hiring remotely on-demand
    Find trusted professionals and pay only for results"

    16) BIZReef
    Freelance Marketplace with a fee per job to contact the buyer.

    17) Freelancer Store.com
    "Freelance Programmer – Freelance Projects – Freelance Websites. This site is Totally FREE! We don’t charge to post projects or charge after accepting a freelancer; which other websites do. We don’t take any commission from freelancers; which other freelance websites do. No sign-up fees, No monthly fees, No commission fees. It’s totally FREE!"

    18) Freelancer Listing
    "Looking for Freelance work? Find the latest freelance job postings and bid on them absolutely FREE!"

    19) eTEQ.com
    "Offering everything that project owners and freelancers could possibly need, eTEQ.com contains auctions, job postings, and freelance ads all for free. Project owners can post their projects for free and have the site’s competent freelancers bid on it while freelancers, on the one hand, can also sign up for free and begin browsing for various projects up for bidding posted in the site."

    20) ITMatch Online
    "Are you a BUYER looking for outsourcing IT or BPO projects? Are you a PROVIDER looking for outsourcing IT or BPO projects? ITMatchOnline is the easiest way to find the right partner." Free registration.

    21) DesignQuote.net
    "The best site on the Net for professional designers."

    22) Moday Works
    "International Service Providers at your Fingertips!"

    23) P2W2
    "P2W2 identifies the right partners, negotiates terms, establishes the outsourcing relationship and manages projects for small business. "

    24) Project Worm
    "Builds bridges between Project Owners and Project Professionals."

    25) RfpDB
    "Welcome to the Request for Proposals Database (RFPdb), your source for RFPs and new project leads. This site is free to join and there is NO fee. The site works on a credit system."

    26) BidItOut.com
    "Work on what you want, when you want and where you want to! The lifestyle of a freelancer is taking off and gives unparalleled job flexibility. By working as a freelancer online, you can greatly increase your client base and job throughput. Have the surety of being paid on-time with our trusted escrow system for payments. For the first time you can even work at home and tap into a global pool of suppliers across a huge range of industries!"

    27) Savvylance
    "Bid on web, graphics and development jobs."

    28) Jobloha
    "It’s a new way for you to find and get work done online. Jobloha is mainly being used by freelancers (Coders, Designers, Writers,…) but offers a great variety of remote work and local job offers. Whether you are looking for the right person to do a specific job for you or you are a freelancer looking for work, Jobloha is right for you."

    29) Jobshuk
    "Outsourcing your project to Israel makes smart business sense – ensuring a balance of high quality, reliability & cost savings. JobShuk connects English-speaking freelancers, small businesses, and service providers based in Israel with the world."

    30) LancerGlobal
    "Find qualified freelancers willing to do the job within your budget! Post your project for free and receive bids instantly."

    31) Freelance Projects
    "All freelance projects at one location."

    32) FreakLance
    "Web and graphic design marketplace."

    33) The Superlancers
    "Fast, simple freelance marketplace."

    34) United States Freelancers
    "Freelance Website to connect International, Offshore, Outsourcing Freelancers and Freelance buyers. UnitedStatesFreelancers! We are pleased to announce that we have made concessions to allow for international, offshore, outsourcing freelance work. As the United States is a huge melting pot, so should our site be… United States Freelancers is open to all international buyers and all international freelancers."

    35) DesignBay
    "Get opportunities to be creative using the DesignBay marketplace."


    List of Non-English Sites

    1) Freelancermap
    Location: Germany

    2) Freelance INDIA.com
    "FreelanceIndia a common platform for freelancer. We help you in finding Project Work, Part-time Jobs, Assignments relevant to your field.
    Location: India

    3) Bumeran.com
    Location: South America

    4) Laborum.com
    Location: Latin America

    5) Trabajo Freelance
    Location: South America

    6) XPlace
    "Express outsourcing.
    Location: Israel

    7) Joobs
    Location: Romania

    8) Pinoy Jobs
    Location: Philippines

    9) Motamot
    Location: France

    10) Okeli
    Location: Sweden

    11) Projekurdu
    Location: Turkey

    12) Circa Lavoro.it
    Location: Italy



    Related Documents
    http://arjudba.blogspot.com/2008/06/how-to-make-money-online-please-read-it.html
    http://arjudba.blogspot.com/2009/07/how-to-setup-google-webmaster-tool-for.html

    Monday, August 17, 2009

    Number format models in oracle

    About Number format models
    About format models in oracle it is specified inside post, http://arjudba.blogspot.com/2009/08/format-models-in-oracle.html
    Number format models is the format by which you can recognize oracle about the input data of number type.

    Number format models are used in the following functions.

    1)TO_CHAR function : TO_CHAR function is used to translate a value of NUMBER, BINARY_FLOAT, or BINARY_DOUBLE datatype to VARCHAR2 datatype.

    2)TO_NUMBER function : TO_NUMBER function is used to translate a value of CHAR or VARCHAR2 datatype to NUMBER datatype.

    3)TO_BINARY_FLOAT and TO_BINARY_DOUBLE function : TO_BINARY_FLOAT and TO_BINARY_DOUBLE functions are used to translate CHAR and VARCHAR2 expressions to BINARY_FLOAT or BINARY_DOUBLE values.

    Consider of using Number format Models
  • All number format models causes number to be rounded to a specified number of
    significant digits

  • If there is more number of digits (to the left of the decimal place) in the value than the number specified in the format models, then the value is replaced by pound sign(#).
    Below is an example.

    SQL> select to_char(343543.98,'$999.99') from dual;

    TO_CHAR(
    --------
    ########

    Here number 343543.98 has total 6 digits on the left of the decimal but in the formal model it is used only 3 digits. So instead of returning real digit # sign is returned.

    If we used correct or more number of 9's than required then it would display right characters.

    SQL> select to_char(343543.98,'$9999999.99') from dual;

    TO_CHAR(3435
    ------------
    $343543.98


  • If NUMBER value is extremely large and cannot be represented in the specified format model, then for positive number the value is replaced by the infinity sign (~) and for negative number the vaue is replaced by the negative infinity(-~) sign.

  • If a BINARY_FLOAT or BINARY_DOUBLE value is converted to CHAR or NCHAR,
    and the input is either infinity or NaN (not a number), then Oracle always returns
    the pound signs to replace the value.


  • Number Format Elements
    Number format model is composed of one or more number format elements. List of number format elements are shown below with examples.

    1)Comma(,): Return a comma in the specified position. Comma can't place at the beginning position or at the right to the decimal point.
    Example:

    SQL> select to_char(98687,'9,999,9') from dual;

    TO_CHAR(
    --------
    9,868,7

    2)Period(.): Return a decimal point in the specified position. Can have at best only one decimal point.
    Example:

    SQL> select to_char(98687,'99999.99') from dual;

    TO_CHAR(9
    ---------
    98687.00

    If the number of digits to the left of the decimal point in the format model is less than the number of digits to the left of the decimal point exist in the real number then # is returned.

    SQL> select to_char(98687,'9999.999') from dual;

    TO_CHAR(9
    ---------
    #########

    If there is multiple period(.) then following error returned.
    SQL> select to_char(98687,'99999.9.9') from dual;
    select to_char(98687,'99999.9.9') from dual
    *
    ERROR at line 1:
    ORA-01481: invalid number format model

    3)Dollar sign($):
    If used within format models then character with leading dollar sign is returned. Can be used any position within format models but not in multiple position.
    Example:

    SQL> select to_char(93,'9$9') from dual;

    TO_C
    ----
    $93

    SQL> select to_char(93,'99$') from dual;

    TO_C
    ----
    $93

    Using $ into multiple position fails with ORA-01481.
    SQL> select to_char(93,'$$99') from dual;
    select to_char(93,'$$99') from dual
    *
    ERROR at line 1:
    ORA-01481: invalid number format model

    4)Zero(0):
    Usage of zero(s)(0) inside format models return leading zeros(0) if inside format model they are used to the left of the decimal point. Multiple usage will return multiple leading zeros. If inside format model zero(s) are used to the right in the decimal point then digits to the right of the real number is filled first and then zero is placed based on the deducting from number of zero(s) inside from model minus number of digits to the right of the real number.

    Examples will clear you more.

    SQL> select to_char(93,'099') from dual;

    TO_C
    ----
    093

    SQL> select to_char(93,'99.0') from dual;

    TO_CH
    -----
    93.0

    SQL> select to_char(93,'099000') from dual;

    TO_CHAR
    -------
    000093

    SQL> select to_char(93.98,'099.000') from dual;

    TO_CHAR(
    --------
    093.980

    SQL> select to_char(93,'099.000') from dual;

    TO_CHAR(
    --------
    093.000


    5)9:
    In the above example you find in all number format model 9 is used. 9 returns value with the specified number of digits with a leading space if positive or with a leading minus if negative. For leading 0 in the number, 9 in the format model prints blank.
    Note that leading 0 becomes NULL unless the number is zero.

    SQL> select to_char(09,'9') from dual;

    TO
    --
    9

    SQL> select to_char(09,'99') from dual;

    TO_
    ---
    9

    SQL> select to_char(0,'99') from dual;

    TO_
    ---
    0


    6)B:
    B inside format model returns blanks for the integer part of a fixed-point number when the integer part is zero.
    Following is an example.

    SQL> select to_char(0,'99') from dual;

    TO_
    ---
    0

    SQL> select to_char(0,'B99') from dual;

    TO_
    ---


    7)C:
    C returns the ISO currency symbol in the specified position. The value is determined from the NLS_ISO_CURRENCY parameter.

    SQL> select to_char(9,'C99') from dual;

    TO_CHAR(9,
    ----------
    USD9

    SQL> select to_char(9,'9C9') from dual;

    TO_CHAR(9,
    ----------
    9USD0

    SQL> select to_char(9,'99C') from dual;

    TO_CHAR(9,
    ----------
    9USD

    8)D:
    Returns a numeric character in the specified position. The character is specified by the parameter NLS_NUMERIC_CHARACTERS. The default is a period (.).
    Example:

    SQL> select to_char(99,'999D99') from dual;

    TO_CHAR
    -------
    99.00

    9)EEEE:
    EEEE returns a value using in scientific notation.
    Example:

    SQL> select to_char(9939,'9EEEE') from dual;

    TO_CHAR
    -------
    1E+04

    SQL> select to_char(9939,'9.EEEE') from dual;

    TO_CHAR(
    --------
    1.E+04

    SQL> select to_char(9939,'9.9EEEE') from dual;

    TO_CHAR(9
    ---------
    9.9E+03

    SQL> select to_char(9939,'9.9999EEEE') from dual;

    TO_CHAR(9939
    ------------
    9.9390E+03

    10)G:
    G returns the group separator in the specified position. The current value is specified by the NLS_NUMERIC_CHARACTER parameter. You can specify multiple group
    separators in a number format model.
    Example:

    SQL> select property_value from database_properties where upper(property_name)='NLS_NUMERIC_CHARACTERS';

    PROPERTY_V
    ----------
    .,

    SQL> select to_char(9939,'99G99') from dual;

    TO_CHA
    ------
    99,39

    SQL> select to_char(9939,'99G9G9') from dual;

    TO_CHAR
    -------
    99,3,9

    Note that a group separator cannot appear to the right of a decimal character or
    period in a number format model.

    11)L:

    L returns the local currency symbol in the specified position. The current value is specified by the parameter NLS_CURRENCY.
    Example:
    SQL> select to_char(9939,'L9999') from dual;

    TO_CHAR(9939,'L
    ---------------
    $9939

    SQL> select to_char(9939,'9999L') from dual;

    TO_CHAR(9939,'9
    ---------------
    9939$

    12)MI:
    For negative value MI returns a trailing minus sign (-).
    For positive value MI returns a trailing blank.
    Note that MI format element can appear only in the last position of a number format model.
    Example:

    SQL> select to_char(34,'9999MI') from dual;

    TO_CH
    -----
    34

    SQL> select to_char(-34,'9999MI') from dual;

    TO_CH
    -----
    34-

    13)PR:
    For negative value PR returns value in <angle brackets>.
    For positive value PR returns a a leading and trailing blank.
    Note that PR format element can appear only in the last position of a number format model.
    Example:

    SQL> select to_char(-34,'9999PR') from dual;

    TO_CHA
    ------
    <34>

    SQL> select to_char(34,'9999PR') from dual;

    TO_CHA
    ------
    34

    14)RN/rn:
    RN returns a value as Roman numerals in uppercase.
    rn returns a value as Roman numerals in lowercase.
    Note that value would be in the integer range between 1 and 3999. If it is outside range it can't display in Roman numerals.
    Example:

    SQL> select to_char(34,'RN') from dual;

    TO_CHAR(34,'RN'
    ---------------
    XXXIV

    SQL> select to_char(44434,'RN') from dual;

    TO_CHAR(44434,'
    ---------------
    ###############

    SQL> select to_char(434,'rn') from dual;

    TO_CHAR(434,'RN
    ---------------
    cdxxxiv

    15)S:
    If we use S as leading position in the format model like S999 then it
    returns negative value with a leading minus sign (-).
    returns positive value with a leading plus sign (+).

    And if we use S as trailing position in the format model like 999S then it
    returns negative value with a trailing minus sign (-).
    returns positive value with a trailing plus sign (+).
    Note that the S format element can appear only in the first or last position of a
    number format model.
    Example:

    SQL> select to_char(-434,'999S') from dual;

    TO_C
    ----
    434-

    SQL> select to_char(434,'S999') from dual;

    TO_C
    ----
    +434

    16)TM:
    TM The text minimum number format model returns (in decimal output) the smallest
    number of characters possible.

    The default is TM9, which means it will return the number in fixed notation unless the output exceeds 64 characters.

    If the output exceeds 64 characters, then Oracle Database automatically returns the number in scientific notation.
    Note that, you must use TM leading position in the format model and you can follow this element only with one 9 or one E (or e).
    Example:

    SQL> select to_char(343000,'TME') from dual;

    TO_CHAR(343000,'TME')
    -------------------------------------------------
    3.43E+05

    17)U:
    U returns the Euro (or other) dual currency symbol in the specified position. The return value is based on the NLS_DUAL_CURRENCY parameter.
    Example:

    SQL> select to_char(786,'U999') from dual;

    TO_CHAR(786,'U
    --------------
    $786

    18)V:
    V returns a value multiplied by power(10,n) (and if necessary, round it up), where n is the number of 9’s after the V.
    Example:

    SQL> select to_char(786,'999V9') from dual;

    TO_CH
    -----
    7860

    SQL> select to_char(786,'999V99') from dual;

    TO_CHA
    ------
    78600

    19)X:
    X returns the hexadecimal value of the specified number of digits. If the specified
    number is not an integer, then Oracle Database rounds it to an integer.

    Note that, while using X format models,
    - You can't use X format models on negative number.
    - The format model X only can precede with 0 or FM.
    - If you dont specify 0 or FM with X, then the return value always has one leading blank.
    Example:

    SQL> select to_char(17,'XXXXX') from dual;

    TO_CHA
    ------
    11

    SQL> select to_char(17,'0XXXXX') from dual;

    TO_CHAR
    -------
    000011

    SQL> select to_char(17,'FMXXXXX') from dual;

    TO_CHA
    ------
    11
    Related Documents

    Sunday, August 16, 2009

    Format Models in Oracle

    A format model in oracle describes the format of datetime or numeric data that to be inserted into database field. It is a character literal that does not change any internal representation of a value. It just represents how oracle will interprets the string(date or number) while inserting data into oracle database.

    Format model just represents how to be inserted into oracle database.

    With an example, I will make this understand.

    Let's create a table named test_format.
    SQL> create table test_format(col1 date);

    Table created.


    Now we try to insert date field into the table.
    SQL> insert into test_format values('11-09-09');
    insert into test_format values('11-09-09')
    *
    ERROR at line 1:
    ORA-01843: not a valid month


    And it fails because '11-09-09' is not recognized as a valid date in oracle. Oracle could not understand this format input. So we need to specify format and make it recognize to oracle about our input format model.

    Now try following sql.
    SQL> insert into test_format values (to_date('11-09-09','DD-MM-YY'));

    1 row created.

    And successfully row is inserted because here we recognize oracle about our input data using 'DD-MM-YY' format. This 'DD-MM-YY' is called the format model.

    If we query the table, we see.
    SQL> select * from test_format;

    COL1
    ---------
    11-SEP-09


    Which is not same as the format in which we inserted data. So we can say format models are just recognise the input data format, but it does not affect any internal represntation of stored data into database.

    Let's now see another example of how we can insert data into database.
    SQL> insert into test_format values('12-SEP-09');

    1 row created.


    Here, we see we did not use any format model but oracle recognize the data and successfully inserted into oracle database. It is because if you don't specify any format model of date then oracle implicitly using the initialization parameter NLS_TERRITORY and use the format model specified using NLS_TERRITORY parameter. Most specifically you can see it from NLS_DATE_FORMAT parameter.


    SQL> col property_value for a10
    SQL> select property_name, property_value from database_properties where property_name='NLS_DATE_FORMAT';

    PROPERTY_NAME PROPERTY_V
    ------------------------------ ----------
    NLS_DATE_FORMAT DD-MON-RR


    So you see here by default it can recongnize date format data specified in format DD-MON-RR and so it can recognize '12-SEP-09' but not 'SEP-12-09'.

    So we must need to use format model while inserting data into the database in order to recognize the format of our input whenever necessary.

    Related Documents

    Saturday, August 15, 2009

    Floating element using CSS Float

    Using CSS you can float an element either left or right using property float. Suppose you have a box and now using float property you can place the box either left or right. By using a simple example we see the effect of float.
    The code is,

    <p style="font-size:1.5em"><u> An example to demonstrate float:right</u></p>
    <div style="border-width:5px; color:rgb(200,0,0);border-color:rgb(100,0,0); border-style:ridge; width:20em; height:8em; float:right">
    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:right effect.
    </div>

    And the output is,

    An example to demonstrate float:right



    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:right effect.


    And now we see the effect of float:left.
    Code is,

    <p style="font-size:1.5em"><u> An example to demonstrate float:left</u></p>
    <div style="border-width:5px; color:rgb(200,0,0);border-color:rgb(100,0,0);
    border-style:ridge; width:20em; height:8em; float:left">
    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:left effect.
    </div>


    And output is,

    An example to demonstrate float:left



    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:left effect.


    Combining together,

    <p style="font-size:1.5em"><u> An example to demonstrate float:left</u></p>
    <div style="border-width:5px;
    color:rgb(200,0,0);
    border-color:rgb(100,0,0);
    border-style:ridge;
    width:20em;
    height:8em;
    float:left">
    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:left effect.
    </div>
    <p style="font-size:1.5em"><u> An example to demonstrate float:right</u></p>
    <div style="border-width:5px;
    color:rgb(200,0,0);
    border-color:rgb(100,0,0);
    border-style:ridge;
    width:20em;
    height:8em;
    float:right">
    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:right effect.
    </div>

    output,

    An example to demonstrate float:left



    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:left effect.

    An example to demonstrate float:right



    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:right effect.

    We can also divide a webpage into several columns. Like we can divide a page into 4 columns. The CSS then look like,

    <div style="border-width:5px;
    color:rgb(200,0,0);
    border-color:rgb(100,0,0);
    border-style:ridge;
    width:22%;
    height:3em;
    float:left " >
    This is a simple text.
    </div>
    <div style="border-width:5px;
    color:rgb(200,0,0);
    border-color:rgb(100,0,0);
    border-style:ridge;
    width:22%;
    height:3em;
    float:left">
    This is a simple text.
    </div>
    <div style="border-width:5px;
    color:rgb(200,0,0);
    border-color:rgb(100,0,0);
    border-style:ridge;
    width:22%;
    height:3em;
    float:left">
    This is a simple text.
    </div>
    <div style="border-width:5px;
    color:rgb(200,0,0);
    border-color:rgb(100,0,0);
    border-style:ridge;
    width:22%;
    height:3em;
    float:left">
    This is a simple text.
    </div>


    This is a simple text.

    This is a simple text.

    This is a simple text.

    This is a simple text.


    In the example of left and right example we see the right elements are moved up to fill the available space which is freed from the left box. This is default behaviour. In CSS float, by default, the subsequent elements are moved up to fill the available space which will be freed when a box is floated to a side. We can change this behaviour by using property clear.

    The property clear can have the values left, right, both or none. The principle is, if clear is set to both for a box, the top margin border of this box will always be under the lower margin border for possible floating boxes coming from above.

    Below is the example,

    <p style="font-size:1.5em"><u> An example to demonstrate float:left</u></p>
    <div style="border-width:5px;
    color:rgb(200,0,0);
    border-color:rgb(100,0,0);
    border-style:ridge;
    width:33%;
    height:8em;
    float:left " >
    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:left effect.
    </div>
    <p style="font-size:1.5em; clear:both; "><u> An example to demonstrate float:right</u></p>
    <div style="border-width:5px;
    color:rgb(200,0,0);
    border-color:rgb(100,0,0);
    border-style:ridge;
    width:33%;
    height:8em;
    float:right">
    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:right effect.
    </div>

    output is,

    An example to demonstrate float:left



    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:left effect.

    An example to demonstrate float:right



    This is a simple text; just for an example to demonstrate the float attribute. In this example we are seeing the effect of float:right effect.







    Wednesday, August 12, 2009

    Position an element in CSS

    With the position property in CSS you can place an element exactly wherever you want inside an HTML page. With using of float you can have almost every combination of positioning an element.

    The positioning an element is based on the coordinates of the system. Suppose if we want to position word "ARJU" 200px from the top of the document and 300px from the left of the document with an addition attribute of red color and twice font size, then our CSS code will be,

    <div style="
    position:absolute;
    top:200px;
    left:300px;
    color:red ;font-size:2em" >Arju</div>

    the output is,
    Arju

    Note that where Arju word now positioned? In fact we have the control to put it anywhere as we want. Is not it interesting? :) Positioning an element with position parameter is really a good technique.

    The position can have a value of absolute or relative. The difference between absolute and relative is, how the position value is calculated.

    An element which is positioned absolute does not obtain any space in the document. This means that it does not leave an empty space after being positioned.

    The position for an element which is relatively positioned is calculated from the original position in the document. That means that you move the element to the right, to the left, up or down. This way, the element still obtains a space in the document after it is positioned.

    Following example should clear your idea,

    <div style="position:absolute; top:500px; left:300px; color:red ;font-size:2em" >Arju</div>
    <span style=" ">T1</span>
    <div style="position:relative; top:500px; left:300px; color:red ;font-size:2em" >Arju2</div>
    <span style=" ">T2</span>
    <div style="position:absolute; top:500px; left:305px; color:red ;font-size:2em" >Arju</div>
    <span style=" ">T3</span>

    If you run above CSS code, you will see after "position: relative" whenever you like to display T2 it is not in the same line as in T1. But after "position:absolute" it is displayed on the same line as T2. Also we displayed both "position: relative" and "position: absolute" in the top and left value. But relative one is slightly to the right, to the left, up or down.

    Arju
    T1
    Arju2
    T2
    Arju
    T3

    Here is more example about positioning of different boxes with top, left, right, bottom property.

    #box1 {
    position:absolute;
    top: 550px;
    left: 550px;
    }

    #box2 {
    position:absolute;
    top: 350px;
    right: 350px;
    }

    #box3 {
    position:relative;
    bottom: 250px;
    right: 350px;
    }

    #box4 {
    position:relative;
    bottom: 350px;
    left: 650px;
    }

    Related Documents