• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is Decode?

 
Shahir Deo
Ranch Hand
Posts: 80
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys ,


What is Decode in Oracle?


Like : decode(?,null,id,?)

What Condition is This? and What does it return?
 
Luk Lukach
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is very abstract. There are many ways to encode information, eventually the encoded information will look differently after encoding.
There are character encoding techniques such as UTF8 UTF16 ASCII etc and there are binary-text encoding techniques such as Base64

I would recommend you to read the JavaDoc of the method you specified and see which encoding it uses.
 
Tim Cooke
Sheriff
Pie
Posts: 3204
142
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Plenty of resources available for this function, like here and here. Any particular aspect of this function that you don't understand?
 
Shahir Deo
Ranch Hand
Posts: 80
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Cooke wrote:Plenty of resources available for this function, like here and here. Any particular aspect of this function that you don't understand?


As i Have Given the Example,

I need to Understand, What it return and what was the Condition.

decode(?,null,id,?)

In the Java Code, We are setting 1st ? as id and 2nd ? as id.
So

decode(5454,null,id,5454);

 
Tim Cooke
Sheriff
Pie
Posts: 3204
142
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the syntax illustration from the Oracle Documentation for DECODE which I linked to before.

Given that your example has 4 parameters it represents the following

So as an example, if I had a table called PEOPLE with a column NAME I could write:

Which would result in a dataset that contains "Hurrah!" for all rows that contain "Tim" in the NAME field and "Boo!" for all other rows.

So, given your usage example

You have your ID in the first parameter which should contain the column name. I'm guessing it's not working too well?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic