Home » SQL & PL/SQL » SQL & PL/SQL » Finding middle Character
Finding middle Character [message #309164] Wed, 26 March 2008 12:56 Go to next message
hamidmahmood
Messages: 30
Registered: August 2006
Member
AOa
i need help i want to fined middle charter of any name
for eg if name is warid it get 'r' as middle character if name is gibs then it get ib is middle character

we also apply this query on ename column of emp table

hope for good and quick replay

[Updated on: Wed, 26 March 2008 12:57]

Report message to a moderator

Re: Finding middle Character [message #309173 is a reply to message #309164] Wed, 26 March 2008 13:15 Go to previous messageGo to next message
vakkalan
Messages: 20
Registered: January 2006
Location: US
Junior Member

Here is the SQL for it ....

SELECT SUBSTR ('string',
ROUND (LENGTH ('string') / 2),
DECODE (MOD (LENGTH ('string'), 2), 0, 2, 1)
)
FROM DUAL

Good luck
Harsha Vakkalanka

[Updated on: Wed, 26 March 2008 13:19]

Report message to a moderator

Re: Finding middle Character [message #309312 is a reply to message #309173] Thu, 27 March 2008 01:55 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
@vakkalan,

Please read and follow OraFAQ Forum Guide.
"How to format your post?" section:
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.

"Responding to Posts" section:
Quote:
When responding to questions, if it is obviously a student with a homework assignment or someone else just learning, especially in the homework and newbies forums, it is usual to provide hints or clues, perhaps links to relevant portions of the documentation, or a similar example, to point them in the right direction so that they will research and experiment on their own and learn, and not provide complete solutions to problems. In cases where someone has a real-life complex work problem, or at least it may seem complex to them, it may be best to provide a complete demo and explanation.


That said, thanks for helping.

Regards
Michel

[Updated on: Thu, 27 March 2008 01:56]

Report message to a moderator

Re: Finding middle Character [message #309356 is a reply to message #309312] Thu, 27 March 2008 03:31 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Both question and answer were moved from the Forms forum; vakkalan probably didn't notice a suggestion (or thought that it may be fully answered if the question wasn't asked in one of the Newbies forums).
Previous Topic: Materialized View
Next Topic: Row prefetch attribute and Stored procedures refcursor
Goto Forum:
  


Current Time: Thu Dec 08 18:06:09 CST 2016

Total time taken to generate the page: 0.18427 seconds