Needing help with CONVERT(CHAR(11))
I need to convert an output(l_line_body_note) to a string and limit the string to a length of 128 characters. I have tried using the Convert to string character and everything i can think of.All help would be greatly appreciated.
l_line_body_Note := '<Notes>' ||'GIA Notice Event '||pc_log_rec.notice_id||': '|| pc_log_rec.pc_comments || '</Notes>';
> I need to convert an output(l_line_body_note) to a
> string and limit the string to a length of 128
> characters. I have tried using the Convert to string
> character and everything i can think of.All help
> would be greatly appreciated.
>
> l_line_body_Note := '<Notes>' ||'GIA Notice Event
> '||pc_log_rec.notice_id||': '||
> pc_log_rec.pc_comments || '</Notes>';
I believe you are using PL/SQL appending. In jave you can use '+' instead of the '||'.
String l_line_body_Note = "<Notes>"
+ "GIA Notice Event"
+ pc_log_rec.notice_id + ": "
+ pc_log_rec.pc_comments
+ "</Notes>";
If you are actually after a PL/SQL answer then I suggest you don't post in a java forum.
Ted.
> I need to convert an output(l_line_body_note) to a
> string and limit the string to a length of 128
> characters. I have tried using the Convert to string
> character and everything i can think of.All help
> would be greatly appreciated.
>
> l_line_body_Note := '<Notes>' ||'GIA Notice Event
> '||pc_log_rec.notice_id||': '||
> pc_log_rec.pc_comments || '</Notes>';
This looks like Oracle PL/SQL not Java, correct?
If it is PL/SQL then see the RTRIM() function.
Message was edited by:
jbish
Regarding the " ... string to a length of 128 characters"In Oracle PL/SQL use substr(my_string,x,y)In Java use myString.substring(x,y)
> Regarding the " ... string to a length of 128> characters"> > In Oracle PL/SQL use substr(my_string,x,y)> In Java use myString.substring(x,y)In my post I suggested RTRIM() from PL/SQL, that should have been RPAD().
> > Regarding the " ... string to a length of 128
> > characters"
> >
> > In Oracle PL/SQL use substr(my_string,x,y)
> > In Java use myString.substring(x,y)
>
> In my post I suggested RTRIM() from PL/SQL, that
> should have been RPAD().
If I did not know if it could be either too long or short, rpad is the better choice.