• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is Decode?

 
Ranch Hand
Posts: 80
Hibernate Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic