How to use SQL functions in the queries

hey guys i wanna know how to use SQL functions in the queries is it possible or not .

Hi,
Wat exactly that set values are?
those from sql query?
How to use count():
The COUNT() function returns the number of rows that matches a specified criteria.
SQL COUNT(column_name) Syntax
The COUNT(column_name) function returns the number of values (NULL values will not be counted) of the specified column:
SELECT COUNT(column_name) FROM table_name
SQL COUNT(*) Syntax
The COUNT(*) function returns the number of records in a table:
SELECT COUNT(*) FROM table_name
SQL COUNT(DISTINCT column_name) Syntax
The COUNT(DISTINCT column_name) function returns the number of distinct values of the specified column:
SELECT COUNT(DISTINCT column_name) FROM table_name
The IN function helps reduce the need to use multiple OR conditions.
The syntax for the IN function is:
SELECT columns
FROM tables
WHERE column1 in (value1, value2, .... value_n);

Similar Messages

  • How to use SQL() function while writing scripts in BODS 4.0

    How to use SQL() function while writing scripts in BODS 4.0

    Hello,
    I think you want to post your question to the [Data Integration and Data Quality Management|Data Services and Data Quality; forum. This forum is for other BusinessObjects SDK development questions.
    Sincerely,
    Dan Kelleher

  • How to use db2 function in the HQL

    hello
    i am newbie to hibernate, now i am choosing a solution for my project, in this project, it use db2 function in the sql clause as follow:
    insert into idstool.access(userid,node,password) values('userid','nodename',encrypt('password','nodename'));
    i wonder if i can implement such function by using hibernate, that is if hibrenate can use the db2 function, or user-defined sql functions? if yes, how?
    thanks for any helps

    I think you'll find that you can do this through HQL. You also have the option of invoking a stored procedure or invoking native SQL in tandem with the normal Hibernate options.

  • REGEXP_REPLACE: How to use a function over the found strings?

    Hello,
    Consider the following:
    select regexp_replace('A1BBCCA2BBCC', '(A.)', '[\1]')
    from dual
    '[A1]BBCC[A2]BBCC'Now I try to put a function on the replaced strings:
    select regexp_replace('A1BBCCA2BBCC', '(A.)', lower('[\1]'))
    from dual
    '[A1]BBCC[A2]BBCC'The result is the same i.e. the function lower has been executed with my reg. expression as a parameter, not the result strings. How can I execute the function passing as a parameter not the reg. expression but the strings, that have been found? (Of course, my real need is to use a custom function, not "lower").
    Thanks in advance.
    Best Regards,
    Beroetz

    I'm sure there must be a simpler way, but this is my first thought... (although strictly speaking in this example I could get rid of the lower function and just include 'a' hardcoded.)
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'A1BBCCA2BBCC' as txt from dual)
      2  -- end of data
      3  select replace(sys_connect_by_path(lower('A'||substr(x,1,1))||substr(x,2),','),',') as x
      4  from (
      5        select REGEXP_SUBSTR(txt, '[^A.]+', 1, level) as x, level rn
      6        from t
      7        connect by level <= length(regexp_replace(txt,'[^A.]*'))
      8       )
      9  where connect_by_isleaf = 1
    10  connect by rn = prior rn+1
    11* start with rn = 1
    SQL> /
    X
    a1BBCCa2BBCC
    SQL>

  • How to use SQL function in Tabular Form

    Edited by: JuniorNewbi on 03-Nov-2009 08:15

    Hi
    I want to have a Tabular Form in which the Report Source sql statement is retrieved via an SQL function, so that the resulting report can show a variable number of columns and column names.
    The following great web site shows just the kind of thing i'm trying to do (Tabular Form Dynamic):
    http://htmldb.oracle.com/pls/otn/f?p=31517:195:518536699796436::NO:::
    However, as an Apex newbie, i don't know how to invoke the SQL function from within the page. The "Report Source" appears to only allow a static "select...." style of entry.
    I don't have access to the Denes Kubicek's workspace so don't know how he would have invoked his PL/SQL Function.
    Can anyone help?
    Thanks in advance!
    Edited by: JuniorNewbi on 03-Nov-2009 08:46

  • How to use bluetooth function for the Mega player(522BT)

    Hello all!!!!!
        Pls ,help me!
    I am from Myanmar.I can't use Mega player(522BT)for PC to the bluetooth function of this device.
    That is ,we can only use the phone to this device.
    I want to know.   Pls,help me.
                             With Regards,
                                    Thwe Thwe(Myanmar)

    Hi,
    You could do something like this,
    http://www.codersrevolution.com/index.cfm/2008/10/14/Flex-Charting-Format-your-X-and-Y-Axi s
    hope it helps!
    Regards ,
    Bhavika

  • How to use PROCESS_PARAMETER function in the Decision Maker

    Hi mates,
    I would really like to know if some of you has already experienced with the "Decision Maker" process (available starting from 7.0 realise). I'm interested to use this process type giving as input a runtime parameter filled in one ABAP program which has been executed before in the same process chain. The input parameter read from the ABAP program will be used in the Decision Maker in order to decide what of next processes will be exectuted.
    Example
    Let's consider this scenario: the program just wirtes the parameter p in the SAP memory with the ID OPT1, OPT2, OPT3
    REPORT  ztest08.
    PARAMETER p TYPE n.
    DATA: prog TYPE sy-repid.
    CASE p.
      WHEN '1'.
        SET PARAMETER ID 'OPT1' FIELD p.
      WHEN '2'.
        SET PARAMETER ID 'OPT2' FIELD p.
      WHEN '3'.
        SET PARAMETER ID 'OPT3' FIELD p.
    ENDCASE.
    For this progam I've created an ABAP process variant called YTEST01 which uses an ABAP variant that is defined with p=1.
    Now, in the formula editor of the Decision Maker, I set this code
    PROCESS_PARAMETER( 'ABAP', 'YTEST01','OPT1', 'LOW', '        0' ) = 1
    Hopefully the Decision Maker should get the parameter p=1 from the SAP memory reached with the ID OPT1. But it doesn't, and it sends me back an error message that some error has occured during the formula.
    Note that, in the formula, I left the last parameter blank.
    Does someone of you already experienced with Decision Maker using PROCESS_PARAMETER operands?
    Thank you very much and best regards,
      Matteo
    Edited by: Stefano Bertuzzi on Nov 28, 2009 5:19 PM

    Hi,
    Please check the link below:
    Is it possible to start process cain with parameter?
    -Vikram

  • How to use SQL Functions (eg : GETDATE()) in Receiver JDBC XML message

    Hi,
    I am using receiver JDBC adapter.
    When record is updated in table, "Timestamp" field should be updated with Database timestamp.

    Hi Dipak,
    Check out below helpful links,
    MySQL :: MySQL 5.6 Reference Manual :: 11.3.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME
    MySQL :: MySQL 5.0 Reference Manual :: 11.3.5 Automatic Initialization and Updating for TIMESTAMP
    Regards,
    Krupa

  • Use SQL function to get the original order number using the invoice number

    Hi All,
    wondering is someone can help me with this challenge I am having?  Often I need to return the original order numbers that created the resulting invoce.  This is a relatively simple seriese of joins in a query but I am wanting to simplify it using a SQL function that can be referenced each time easily from with in the SELECT statement.  the code i currently have is:
    Use SQL function to get the original order number using the invoice number
    CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
    RETURNS nvarchar(200)
    AS
    BEGIN
    DECLARE @OrderList nvarchar(200)
    SET @OrderList = ''
    SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
    FROM  OINV AS T1 INNER JOIN
          INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
          DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
          RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
          ORDR AS T6 ON T5.DocEntry = T6.DocEntry
    WHERE T1.DocNum = @InvNum
    RETURN @OrderList 
    END
    it is run by the following query:
    Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
    From OINV T1
    Where T1.DocNum = 'your invoice number here'
    The issue is that this returns the order number for all of the lines in the invoice.  Only want to see the summary of the order numbers.  ie if 3 orders were used to make a 20 line inovice I only want to see the 3 order numbers retuned in the field.
    If this was a simple reporting SELECT query I would use SELECT DISTINCT.  But I can't do that.
    Any ideas?
    Thanks,
    Mike

    Thanks Gordon,
    I am trying to get away from the massive table access list everytime I write a query where I need to access the original order number of the invoice.  However, I have managed to solve my own problem with a GROUP BY statement!
    Others may be interested so, the code is this:
    CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
    RETURNS nvarchar(200)
    AS
    BEGIN
    DECLARE @OrderList nvarchar(200)
    SET @OrderList = ''
    SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
    FROM  OINV AS T1 INNER JOIN
          INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
          DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
          RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
          ORDR AS T6 ON T5.DocEntry = T6.DocEntry
    WHERE T1.DocNum = @InvNum
    GROUP BY T6.DocNum
    RETURN @OrderList 
    END
    and to call it use this:
    Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
    From OINV T1
    Where T1.DocNum = 'your invoice number'

  • How to use complex function as condition in Oracle Rule Decision Table?

    How to use complex function as condition in Oracle Rule Decision Table?
    We want to compare an incoming date range with the date defined in the rules. This date comparison is based on the input date in the fact & the date as defined for each rule. Can this be done in a decision table?

    I see a couple of problems here.
    First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
    Prabu ammaiappan wrote:
    Hi,
    I Have a group function in the Query. Below is the Query i have used it,
    GROUP BY S.FREIGHTCLASS,
    R.CONTAINERKEY,
    S.SKU,
    S.DESCR ||S.DESCRIPTION2,
    S.PVTYPE,
    RD.LOTTABLE06,
    R.WAREHOUSEREFERENCE,
    RD.TOLOC,
    R.ADDWHO,
    R.TYPE,
    S.CWFLAG,
    S.STDNETWGT,
    S.ORDERUOM,
    R.ADDDATE,
    C.DESCRIPTION,
    (CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
    NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
    RDD.BRAND,
    S.NAPA,
    RD.RECEIPTKEY,
    R.SUSR4,
    P.POKEY,
    RDD.SUSR1,
    r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
    rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
    If you want to apply a filter condition such as:
    trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
    select ....
      from ....
    where ....
    group by ....
    having max(some_date) between this_date and that_date;Hope that helps,
    -Mark

  • How to use MAX function in SSAS MDX Query

    I want to run this Query with MAX Condition on LAST_DATA_UPDATE Column .

    Hi Ashishsingh,
    According to your description, you want to know how to use MAX function in SQL Server Analysis Services MDX Query, right? In this case, please refer to the link below which describe the syntax and sample of MDX function.
    http://technet.microsoft.com/en-us/library/ms145601.aspx
    http://www.mdxpert.com/Functions/MDXFunction.aspx?f=64
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to use TRUNC function with dates in Expression Builder in OBIEE.

    Hi There,
    How to use TRUNC function with dates in Expression Builder in OBIEE.
    TRUNC (SYSDATE, 'MM') returns '07/01/2010' where sysdate is '07/15/2010' in SQL. I need to use the same thing in expression builder in BMM layer logical column.
    Thanks in advance

    use this instead:
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(CURRENT_DATE) * -1) + 1, CURRENT_DATE)

  • How to use HexToRef function?

    How to use HexToRef function?

    Exactly HexToRef!
    please, try this:
    create or replace
    TYPE "TOBJECT" as object
    Guid RAW(16)
    create table t$tobject of tobject;
    insert into t$tobject values (TOBJECT(SYS_OP_GUID()));
    select HEXTOREF(REFTOHEX(REF(t))) from t$tobject t;
    Error report:
    SQL Error: ORA-24360: 'Type Descriptor Object' не задан для 'Object Bind/Define'
    24360. 00000 - "Type Descriptor Object not specified for Object Bind/Define"
    *Cause:    Type Descriptor Object is a mandatory parameter for Object Types
    Binds and Defines.
    *Action:   Please invoke the OCIBindObject() or OCIDefineObject() call
    with a valid Type Descriptor Object.

  • How to use a Web Template with queries from multiple BW Systems?

    Hi all,
    can anybody help me how to use a Web Template with queries (DATA PROVIDER)in it from multiple BW Systems?
    Thanks in advance, best regards
    Frank

    Great! Thanks for the quick response.
    Have you tried this for XMLA datasources created within the EP system also?
    i.e use Web Analyzer to create a view from the XMLA source and use that view within WAD?
    Thanks.

  • How to use standard function keys as custom keys

    how to use standard function keys as custom keys.
    i have encountered that problem while developing a screen, there i'm supposed to use standard function key F2 ( which actually meant for choose) for clearing the screen fields where the cursor is present and f1 for saving data that entered in screen fields, etc...
    kindly help me out.

    Hi ,
    Solution to use SAP reserve function keys F1 .. F4 (mostly this requirement comes up for RF screens) can be acheived by assigning your new Function code using the Menu path Utilities --> F key Consistency in the Menu Painter (SE41) . Once you assign your cutom function code to the standard Fn keys the only remaining step is to make sure that you set a curson on any of the field on sceen by using the Key Word "SET CURSOR" .
    If you dont use the key word SET CURSOR in the PBO of the screen then you might not see any response for F4.
    Thanks

Maybe you are looking for

  • How do I use my Itunes credit on the Mac App store

    I have a credit in iTunes which I wish to use to buy some apps on the Mac App store. However it doesnt seem to be taking that payment method. How do I solve this?

  • Regarding PM report?

    in PM is there any standard report  in which we can give input as purchase order number and it will show us the corresponding Service Order number thanks in advance

  • Can anyone help!! with Edirol FA 66 Audio interface and Logic Pro 7

    Hi I really need help!! I have Logic Pro 7 and just have brough tnew Audio interface. I have connected it up via Firewire and my Mac has recognised drivers for interface. I am plugging midi keyboard up to interface using two midi cables but cant get

  • Cron RSS Reader

    So I've been using newsbeuter like many people for over a year now. However, the one complaint I and many others have voiced on the forums is that: there exists no cron RSS reader. Sure you can run newsbeuter 24/7 with the auto-refresh feature enable

  • How can I export an external calendar to my Apple calendar on the Macbook? ie: Airbnb Calendar.

    Can anyone help? I would like the schedule information on the Airbnb site Calendar to appear on he Macbook. So far i've been able to manage it on the iphone but not the computer.  Thank you!