Home » Developer & Programmer » Forms » Casting single letter as char(1) (Forms 6i)
Casting single letter as char(1) [message #351080] Mon, 29 September 2008 04:10 Go to next message
didiera
Messages: 134
Registered: August 2007
Location: Mauritius
Senior Member
Hello again,

I wanted to know if it were possible for me to retrieve a single letter from a varchar field into a char field of lenght 1. I have been around and tried CASTing and though in PL/SQL it's ok, it doesn't compile in forms 6i stating that expression is of wrong type the code actually looks like this :

select nvl(my_char_field,cast(substr(my_varchar_field,1,1) as char))  from my_table;


By the way what this query seeks to achieve is to replace the eventual missing values from my_char_field by the first character of my_varchar_field... but type casting screws up; maybe because it's Forms 6i?

regards,
DIdz
Re: Casting single letter as char(1) [message #351117 is a reply to message #351080] Mon, 29 September 2008 06:15 Go to previous messageGo to next message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm unable to test it, but - wouldn't simple
:block_name.your_char_item := substr(:block_name.your_varchar_item, 1, 1);
do the job, even without casting?
Re: Casting single letter as char(1) [message #351201 is a reply to message #351080] Mon, 29 September 2008 18:56 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I thought Forms only had tiems of typer 'char'. There is no 'varchar' in the Data Type list.

David
Re: Casting single letter as char(1) [message #351211 is a reply to message #351201] Mon, 29 September 2008 22:30 Go to previous messageGo to next message
didiera
Messages: 134
Registered: August 2007
Location: Mauritius
Senior Member
Hello Martin,

well I use Forms6i and I actually use varchar strings, you even have varchar2 type. But anyway don't bother with that post. I have found some workaround anyway.

thanks everyone
Didz
Re: Casting single letter as char(1) [message #351221 is a reply to message #351211] Tue, 30 September 2008 00:27 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
My name is 'David'. It is the name that I place at the end of all of my posts.

David
icon12.gif  Re: Casting single letter as char(1) [message #351286 is a reply to message #351221] Tue, 30 September 2008 04:02 Go to previous messageGo to next message
didiera
Messages: 134
Registered: August 2007
Location: Mauritius
Senior Member
my apologies David

Far from me the audacity of running a chance to get a cap in my head with your signature on the cartridge. We're cool pal?

cheers,
Didz
Re: Casting single letter as char(1) [message #351441 is a reply to message #351286] Tue, 30 September 2008 19:51 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
We're cool.

David
Previous Topic: [FORMS] HOW MAKE UPDATE VIEW in FORMS??
Next Topic: Forms with Mac OS
Goto Forum:
  


Current Time: Wed Dec 07 12:21:01 CST 2016

Total time taken to generate the page: 0.08881 seconds