Help me understand this

  • DECODE(addr.pk_dynreport.f_chk_omit('ccard_auto_renew'),'Y', NULL, circ.subs_bill_util.ccard_status(account))

    Guyz someone please hep me understand this sql above. I know the decode statement and addr&circ are databases. When i did

    select * from addr.pk_dynreport.f_chk_omit

    it said sql command not properly ended.

    In toad i saw pk_dynreport in functions under addr databse and circ.subs_bill_util in procedures under CIRC databse.

    I have to obtain a column using this code.

    Thank you.

  • varunkum (1/13/2011)


    DECODE(addr.pk_dynreport.f_chk_omit('ccard_auto_renew'),'Y', NULL, circ.subs_bill_util.ccard_status(account))

    Guyz someone please hep me understand this sql above. I know the decode statement and addr&circ are databases. When i did

    select * from addr.pk_dynreport.f_chk_omit

    it said sql command not properly ended.

    In toad i saw pk_dynreport in functions under addr databse and circ.subs_bill_util in procedures under CIRC databse.

    I have to obtain a column using this code.

    This is kind of confusing to me.

    First, if you "know the decode statement" (actually a function) I assume you are not asking about how DECODE works.

    Second, are you trying to run that "select *..." command while logged into an Oracle database?

    If this is the case the syntax addr.pk_dynreport.f_chk_omit is wrong, there is not three parts FROM clause in Oracle - at least not separated with dots.

    A proper FROM clause should indicate...

    [schema_owner].table_name [alias]

    where schema_owner and alias are optional.

    Still not sure what your question is. 🙂

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • I am fairly certain that pk_dynreport is a package. In which case, in the following syntax:

    addr.pk_dynreport.f_chk_omit('ccard_auto_renew')

    addr is the schema

    pk_dynreport is the package (ahem its starts with pk_)

    f_chk_omit is the function inside the package (ahem it starts with f_)

    'ccard_auto_renew' is the argument to the function.

    So that explains why your statement is incomplete. You've called a function without an argument.

    So what are you actually trying to do? Just understand that statement?

    A package contains variables in various scopes, a number of public and private functions. It can (and usually does) contain procedural code.

    If its in a decode statement like that then it must return a scalar (a single value rather than a rowset)

  • Please do "DESC ADDR", "DESC CIRC", "DESC addr.pk_dynreport" and "DESC circ.subs_bill_util".

    Because we need to know what this objects are: dblinks, schemas, packages, or non-existant ?

    You cannot SELECT * FROM <FUNCTION>.

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply