On January 27th, this site will be read-only as we migrate to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,534 Users
  • 2,269,755 Discussions
  • 7,916,775 Comments

Discussions

Wrong Space - Is these syntax supported in oracle?

RameshSagar
RameshSagar Member Posts: 53 Red Ribbon
edited Sep 15, 2020 12:27PM in SQL & PL/SQL

Hi All,

I am looking for a help in knowing if below function syntax works in Oracle. I only need to know, if Oracle supports these combinations of functions.

1)  sign(count(request_id)) as 'Customer'

2)  (COUNT(SESSION_ID) - sum(is_open)) as 'CLOSED'

     -The values of is_open is from case statement as below:-

          case VERDICT

               WHEN 0 THEN 1

               ELSE 0

          END is_open

Sorry, for keeping this question too short with too less information. Please note, the above syntax works good in MSSQL Server

Tagged:

Answers

  • KayK
    KayK Bonn, GermanyMember Posts: 1,743 Bronze Crown
    edited Sep 15, 2020 1:58AM

    Hi Ramesh,

    how about some testing ? Your code doesn't look weired, so try it.

    Perhaps you get more answers if move your thread to

    regards

    Kay

  • KayK
    KayK Bonn, GermanyMember Posts: 1,743 Bronze Crown
    edited Sep 15, 2020 2:05AM

    it will work

    < scott:[email protected] > select sign(count(empno)) from emp;SIGN(COUNT(EMPNO))------------------                11 Zeile wurde ausgewählt.< scott:[email protected] > select ( count(empno) - sum(is_open)) as closed from (select empno, case comm when 1400 then 0 else 1 end is_open from emp);    CLOSED----------        11 Zeile wurde ausgewählt.
  • RameshSagar
    RameshSagar Member Posts: 53 Red Ribbon
    edited Sep 15, 2020 2:45AM

    Thanks a ton for validating @KayK

    Hi Every,

    Appreciate any help, suggestions, alternatives etc.

  • jaramill
    jaramill Member Posts: 4,299 Gold Trophy
    edited Sep 15, 2020 10:27AM

    MODERATORS :  Please close this thread down as OP has created a duplicate thread here --> Is these syntax supported in oracle?

  • Frank Kulash
    Frank Kulash Boston, USAMember, Moderator Posts: 43,001 Red Diamond
    edited Sep 15, 2020 12:27PM

    Hi,

    RameshSagar wrote:...Appreciate any help, suggestions, alternatives etc.

    Yes, there are always alternatives.

    If those alternatives are any better for doing what you want in your version of Oracle with you data depends on what you want, on your version, and on your data.  Post CREATE TABLE and INSERT statements for a little sample data and the exact results you want from that sample data.  Explain what you are doing, that is, why (in general terms) you want those specific results from that specific data.  Give your full version number, e.g. 12.2.0.2.0.

    See the Forum FAQ:

    Make sure there is a one-to-one correspondence between problems and threads.  Post each separate problem in a separate thread, but don't start more than one thread for the same problem.