0
select * from  Tablename where 1=1 and 
      decode (
             REGEXP_COUNT ('TEST1,TEST2', ','),
                          0,
                          TableName.Srcsyscd = 'CONCUR',
                          TableName.Srcsyscd='SAP'
             )

Error while executing command: [Error] Execution (38: 64): ORA-00907: missing right parenthesis

Please help to provide a solution by using decode only

1
  • If you can write in words what you want, anyone can help. The query you posted is not making more sense, Commented Oct 10, 2016 at 12:44

2 Answers 2

1

When putting DECODE in the WHERE clause, it can be used to remove rows that don't match some value. If that's your intent, you should compare it to something. For example:

select * from  Tablename where 1=1 and 
      TableName.Srcsyscd = decode (
                             REGEXP_COUNT ('TEST1,TEST2', ','),
                                         0,
                                         'CONCUR',
                                         'SAP'
                            )

If you want to show it, put it in the SELECT clause like this:

select Tablename.*,
         decode (
                 REGEXP_COUNT ('TEST1,TEST2', ','),
                             0,
                             'CONCUR',
                             'SAP'
                )

  from Tablename

In both cases it will make more sense if you replace 'TEST1,TEST2' with a column name.

Sign up to request clarification or add additional context in comments.

Comments

0

I guess you wanted

SELECT *
FROM   tablename
WHERE  1 = 1
       AND tablename.srcsyscd =
       decode(regexp_count('TEST1,TEST2', ','), 0, 'CONCUR', 'SAP')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.