Re: [Q] String Concatination
Posted in 1998
Richard Hurt wrote: > > I am tring to build a query that returns a char (10) with some data > attatched to the end. > > SELECT (name_first || ',' || name_last) || '1' > > name_first name_last > --------------- ----------------- > ROBERT SMITH > BOB HURT > JIMMY SMITHSON > JO JO > > My result set should be: > ROBERT,SM1 > BOB,HURT 1 > JIMMY,SMI1 > JO,JO 1 I always find the two step approach using temp tables useful for this kind of stuff: Select trim(name_first) || "," || trim(name_last) name from mytable into temp fred; select name[1,9] || "1" from fred; Alternatively you could write an stored procedure to do this either using the temp table or using SPL only. Art S. Kagel