Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2008
    Posts
    464

    Unanswered: understanding another query

    Hi

    Trying to understand how the following statement works:

    Code:
    select schema.unpeg(lag(counter1)over(order by counter2,counter3 asc,counter4 asc),counter1) as ABCD
    Would really appreciate some help

    Regards

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    post proof it works
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    We do not know what "unpeg" is doing.
    It sure isn't an Oracle function, so it's something you have written yourself (or someone in your company)

    And it's not a complete statement either (the FROM is missing)

  4. #4
    Join Date
    Aug 2008
    Posts
    464
    True, it isn't a complete statement. I was just trying to understand the 'unpeg' line. Couldn't find much on the Internet.

  5. #5
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by shajju View Post
    I was just trying to understand the 'unpeg' line.
    As I said: that must be something that you or someone from your company has implemented.

  6. #6
    Join Date
    May 2009
    Posts
    13
    How about looking at the Function definition:

    select text from all_source where name = 'UNPEG' order by line

  7. #7
    Join Date
    Oct 2002
    Location
    Cape Town, South Africa
    Posts
    253
    Like the others said, the SQL is incomplete. The unpeg is a function in a different schema and it is a user-defined function (not an oracle built-in).

    The "lag(counter1)over(order by counter2,counter3 asc,counter4 asc)" is an Oracle analytic function which allows for group aggregation and processing within a result set.
    See: ORACLE-BASE - LAG and LEAD Analytic Functions
    or the oracle documentation: LAG

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •