Results 1 to 4 of 4

Thread: Regarding functions in sql

  1. #1
    Junior Member
    Join Date
    Feb 2007
    Answers
    10

    Regarding functions in sql

    Hi,

    I am trying out various functions in SQL.

    I did not understand the second form of INSTR.it looks like this
    INSTR(COL_name,string,num1,num2).Can anyone explain?

    And in TRIM function even though I specified lead it trims both the ends
    Ex:-select ename,trim('a' in ename)lead from emp;

    In round function,e=what actually happens if we gave the second argument negative?

    ex:-select round(45.3,-2) from dual;why does this return 0??


  2. #2
    Expert Member
    Join Date
    Dec 2006
    Answers
    204

    Re: Regarding functions in sql

    INSTR(COL_name,string,num1,num2).
    I am not aware of this function.

    Ex:-select ename,trim('a' in ename)lead from emp;
    for lead trim, u should give as LTRIM(str). not like that.

    In round function,what actually happens if we gave the second argument negative?
    It will rounds off the digits before decimal point(right side of decimal point).
    45.34 - 2 digits in right. its 0.


  3. #3
    Expert Member
    Join Date
    Sep 2006
    Answers
    130

    Re: Regarding functions in sql

    Hi Radhi,

    I think i have to answer for INSTR function alone, Barbie has already explained about TRIM & ROUND functions :-)

    Basically, Instr function returns numeric position of the named string passed as 2nd parameter. m & n are optional, u can provide a position m to start searching and the occurence n of the string. If m and n are provided, then the default value is 1, meaning start the search at the beginning of the search and report the first occurrence.

    SQL> select instr('RADHIRANI','A'), instr('RADHIRANI','A',1,1), instr('RADHIRANI','A',1,2) from dual;

    INSTR('RADHIRANI','A') INSTR('RADHIRANI','A',1,1) INSTR('RADHIRANI','A',1,2)
    ---------------------- -------------------------- --------------------------
    2 2 7

    *** Innila ***


  4. #4

    Hello all

    Hello Every body,
    I am knew this site, please extend your hands to help more inthis regard,

    thanks a lot to evey one who are all in this site.

    Regards,
    Kiran
    Quote Originally Posted by Radhi09 View Post
    Hi,

    I am trying out various functions in SQL.

    I did not understand the second form of INSTR.it looks like this
    INSTR(COL_name,string,num1,num2).Can anyone explain?

    And in TRIM function even though I specified lead it trims both the ends
    Ex:-select ename,trim('a' in ename)lead from emp;

    In round function,e=what actually happens if we gave the second argument negative?

    ex:-select round(45.3,-2) from dual;why does this return 0??



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact