Here is the block (note there is a line break in v_var)
When I submit that text area however...
The value of the textarea is mapped to a param
Both of the values getting logged there are 22 - for each line break I have, it gets counted as two characters. Now I understand why this would be counted as such, with Kanji and other special characters out there - although, if that is the case, wouldn't all characters, even the 'normal' ones equal 2 characters there?
My question is, what is the difference between here and the anonymous block I ran earlier?
I guess it must have something to do with the difference between SQL and PL SQL (I think of this as I have typed most of this thread out...)
Is there any way to reconcile these LENGTH values?
True wisdom is in knowing you know nothing - Socrates
Line breaks are either 1 byte, or 2 bytes long. Generally on UNIX/Linux platforms it's 1 byte, while on Windows it's 2 bytes. So quite possibly if I type text in a textbox in Firefox in Linux, the line breaks are submitted as a 1 byte character. If I do the same in Firefox on Windows, the page break will be 2 bytes long. More details on the difference of carriage returns can be seen here: http://koenaerts.ca/dos2unix-equivalent/
So best thing to do on the server side, is to convert 2-byte carriage returns to a 1-byte equivalent, and then do your character count. This can be easily done in your Oracle stored procedure - i.e. replace(my_string_value, chr(13))
Yeah I am not sure why I didn't think to just replace line returns with a blank space or something (for the count sake only, not changing input values)
I think I was too focused on learning about the differences between different length functions and the like
Thanks though, I will just go with this solution.
subject: getting different number for LENGTH() in anon block vs sql pckg