Home » Developer & Programmer » Forms » Query (Windows XP Oracle 9i Dev 6i)
Query [message #340293] Tue, 12 August 2008 04:19 Go to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Hi guyz,

anyone know how to do this query.

select to_char(sysdate,'DDMMYYYY')into :text_item from dual;
the resule will display like this

TO_CHAR(
--------
12082008

i wanna to enter some text before this date as below is the example

XXX-12082008

Regards
Re: Query [message #340296 is a reply to message #340293] Tue, 12 August 2008 04:33 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Concatenation.
SQL> select 'xxx-' || to_char(sysdate, 'ddmmyyyy') result from dual;

RESULT
------------
xxx-12082008

SQL>
Re: Query [message #340338 is a reply to message #340293] Tue, 12 August 2008 07:10 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Wooooooooooooooo.....

Its working..........fine little.........thanks a tons...


Regards
Re: Query ( Hi Little ) Read it again please [message #340378 is a reply to message #340293] Tue, 12 August 2008 09:16 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Hi Little,

thanks for your reply.

if there anyway to do increment as below

select 'XXX-' ||to_char(sysdate,'DDMMYYYY') into :text_item from dual;

XXX-12082008

can we do increment if we found this same in the row like below

XXX-12082008-1
XXX-12082008-2

i tried a lot but i didnt find my solution...

Regards

[Updated on: Tue, 12 August 2008 09:17]

Report message to a moderator

Re: Query ( Hi Little ) Read it again please [message #340424 is a reply to message #340378] Tue, 12 August 2008 16:05 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It is possible; though, you owe us an explanation HOW are these values generated.

10g SQL solution might look like this:
SQL> select 'xxx-' || to_char(sysdate, 'ddmmyyyy') || '-' || to_char(level) result
  2  from dual
  3  connect by level < 5;

RESULT
-----------------------------------------------------
xxx-12082008-1
xxx-12082008-2
xxx-12082008-3
xxx-12082008-4

SQL>
but I'm not sure this is what you are looking for. Also, I don't think it will work in Forms 6i. However, one of row generator techniques might probably be useful.

Another option is to use a sequence, such as
SQL> select 'xxx-' || to_char(sysdate, 'ddmmyyyy') || '-' ||
  2          to_char(my_seq.nextval) result
  3  from dual;

RESULT
-----------------------------------------------------
xxx-12082008-1

SQL> /

RESULT
-----------------------------------------------------
xxx-12082008-2

SQL> /

RESULT
-----------------------------------------------------
xxx-12082008-3

SQL>
Re: Query [message #340471 is a reply to message #340293] Wed, 13 August 2008 01:15 Go to previous message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
thanks little you solve my big problem.....


Regards
Previous Topic: How to display label in two rows
Next Topic: List Of Value Using The KEY-F9 Trigger
Goto Forum:
  


Current Time: Fri Dec 09 14:00:01 CST 2016

Total time taken to generate the page: 0.19346 seconds