Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Oracle: CHAR-padding on compare with a larger literal & LIKE

Chacham (981) writes | more than 6 years ago

Oracle 0

There are a few Oracle blogs that cover the basics. A simple query to prove a point, test the boundaries, or review a basic action. Like Laurent Schneider's or Andrew Clarke's.

There are a few Oracle blogs that cover the basics. A simple query to prove a point, test the boundaries, or review a basic action. Like Laurent Schneider's or Andrew Clarke's.

Andrew has an entry on CHARs. CREATE a TABLE using a CHAR(2) or higher, and query it with a literal. I thought that Oracle would only pad the literal until it matches the CHAR. Wrong! It pads the smaller value to the larger. What's the difference? If the literal has *more* spaces than the COLUMN allows. I though that would be an inequality, but Oracle pads the *TABLE's* value to match the literal before the comparison.

Then Laurent comments that with LIKE there is no such automatic padding, with *a historical note.

Kudos to those two.

---
*proudly leaving off the "n".

cancel ×

0 comments

Sorry! There are no comments related to the filter you selected.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>