Home » SQL & PL/SQL » SQL & PL/SQL » substring picturename from path [merged] (window server2003,oracle developer suite10g ,oracle DB 10g)
substring picturename from path [merged] [message #437660] Tue, 05 January 2010 07:34 Go to next message
tonna
Messages: 33
Registered: November 2009
Location: thai
Member

Hello, experts i'm just beginning for coding pl/sql, please help me,i want to know how to use function substring in oracle pl/sql to substring picture name(picture.jpg) from path picture.

example : C:\Documents and Settings\All Users\Desktop\picture.jpg

i want to know how to use function to substring that's output give only "picture.jpg". Help me please ,that's very kind of you. Thank for experts.... I'm waiting for answer.
Re: substring picturename from path [message #437664 is a reply to message #437660] Tue, 05 January 2010 07:39 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
To extract file name from the path, you do not require to go for PL/SQL. One SELECT query can solve your problem.
INSTR and SUBSTR functions required in your case.
See examples.

regards,
Delna
Re: substring picturename from path [message #437668 is a reply to message #437660] Tue, 05 January 2010 07:51 Go to previous messageGo to next message
joy_division
Messages: 4618
Registered: February 2005
Location: East Coast USA
Senior Member
Here's some hints.

If you use a negative number in the SUBSTR function, you can count from the end.
If you use the INSTR function you can find the position of the '/' character.
Re: substring picturename from path [merged] [message #437671 is a reply to message #437660] Tue, 05 January 2010 07:59 Go to previous messageGo to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
You should not multipost for the same question. You have already got the answer.
Re: substring picturename from path [merged] [message #437931 is a reply to message #437660] Wed, 06 January 2010 09:39 Go to previous messageGo to next message
tonna
Messages: 33
Registered: November 2009
Location: thai
Member

Hello, expert Could you please give me example code how to substring that count from the end of string path to first" / "
and substring that give result is "picturename.jpg" . I'm just start to coding pl/sql and this is part of my homework. I waiting for answer,and hope experts help me please.


Thank you very much. That's very kind of you.


Re: substring picturename from path [merged] [message #437934 is a reply to message #437931] Wed, 06 January 2010 09:44 Go to previous messageGo to next message
Littlefoot
Messages: 20827
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As a student, perhaps you should put some effort in reading the documentation (SUBSTR, INSTR functions) and try to find the solution by yourself. It really isn't that difficult. Maybe you won't succeed at first, but try it! If it doesn't work, come back and present what you have done - we'll assist.
Re: substring picturename from path [merged] [message #437939 is a reply to message #437934] Wed, 06 January 2010 09:56 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
...Documentation at Database SQL Reference

Regards
Michel
Re: substring picturename from path [merged] [message #438117 is a reply to message #437931] Thu, 07 January 2010 03:34 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Have you gone through the link I provided in my first post of this thread. It contains example of both SUBSTR and INSTR with its syntax. If you are facing any problem, then let us know what is that issue.

regards,
Delna
Re: substring picturename from path [merged] [message #438122 is a reply to message #437660] Thu, 07 January 2010 03:47 Go to previous messageGo to next message
Its_me_ved
Messages: 979
Registered: October 2009
Location: India
Senior Member
You could have read the examples provided by Delna.

ved@orafaq> with test
  2  as
  3  ( select '\a\b\abc.txt' a from dual)
  4  select substr(a,instr(a,'\',-1)+1,length(a)) from test
  5  /

SUBSTR(
-------
abc.txt
Re: substring picturename from path [merged] [message #438130 is a reply to message #438122] Thu, 07 January 2010 04:05 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And this is still not spoon feeding?

Do NOT go against what other posts try to do: letting OP learn by himself.
Do NOT say you are dump enough to not see we are doing this and to have forgotten we already said it to you.

Regards
Michel
Re: substring picturename from path [merged] [message #438156 is a reply to message #438130] Thu, 07 January 2010 04:57 Go to previous messageGo to next message
Its_me_ved
Messages: 979
Registered: October 2009
Location: India
Senior Member
Huh!!!! In my previous when I tried putting some hint you talk about correct reply and when I put complete result you are talking about guidelines!!!!!

This is not the first time, you put your useless comment before also while trying to help OP providing Hint (Though that hint was
enough to help the OP to show the path...Not saying the best solution that was from performance perspective).


[Updated on: Thu, 07 January 2010 04:59]

Report message to a moderator

Re: substring picturename from path [merged] [message #438159 is a reply to message #438156] Thu, 07 January 2010 05:18 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The rules are clear, you deliberatly chooses to ignore them and you are insincere as in your discussion with Littlefoot in Sorting strings in Order topic and as all discussions you have with anyone.

Regards
Michel
Re: substring picturename from path [merged] [message #438161 is a reply to message #438159] Thu, 07 January 2010 05:23 Go to previous messageGo to next message
Its_me_ved
Messages: 979
Registered: October 2009
Location: India
Senior Member
Ok, I prefer to ignore YOU here!
Re: substring picturename from path [merged] [message #438164 is a reply to message #438161] Thu, 07 January 2010 05:32 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Ignore me but do not ignore the rules and show a little respect in what they and other posters are trying to do: improve those who ask skills.

Regards
Michel

[Updated on: Thu, 07 January 2010 05:32]

Report message to a moderator

Re: substring picturename from path [merged] [message #438166 is a reply to message #438130] Thu, 07 January 2010 05:37 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Michel Cadot wrote on Thu, 07 January 2010 11:05
And this is still not spoon feeding?

Do NOT go against what other posts try to do: letting OP learn by himself.
Do NOT say you are dump enough to not see we are doing this and to have forgotten we already said it to you.

Regards
Michel

The Forum Guide mentions
Responding to Posts

When responding to questions, if it is obviously a student with a homework assignment or someone else just learning, 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.

It looks to me that the current problem looks very complex to the original poster.
Furthermore, nowhere in the guide it says one CAN or SHOULD not post an answer, it only states "it is usual to provide hints[...] and not provide complete solutions"
Re: substring picturename from path [merged] [message #438167 is a reply to message #438166] Thu, 07 January 2010 05:42 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
It looks to me that the current problem looks very complex to the original poster.

How could you know that? he didn't show what he tried nor if he tried something.
Everything seems very complex when you don't start to try to do it and/or search to find how to do it.
The opposite is that every question is complex for the poster, otherwise he:she didn't post it and so we can remove the sentence from the guide.

Regards
Michel
Re: substring picturename from path [merged] [message #438168 is a reply to message #438166] Thu, 07 January 2010 05:44 Go to previous messageGo to next message
Michel Cadot
Messages: 63818
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I just see your answer in another topic:

Quote:
Agreeing on not providing solutions for the most blatant homework issues is not the same as not giving solutions at all.


And here OP said:

Quote:
I'm just start to coding pl/sql and this is part of my homework.


For the rest of the sentence see the other topic.

Regards
Michel
Re: substring picturename from path [merged] [message #438185 is a reply to message #438168] Thu, 07 January 2010 06:52 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
But still, nothing in the forum guide prohibits anyone from providing complete solutions.
All this commenting on not to give solutions (and yes, including my own replies here) only obscures the actual helpful replies.
Previous Topic: Help in PROCEDURE
Next Topic: Between dates sql
Goto Forum:
  


Current Time: Sat Oct 01 07:38:55 CDT 2016

Total time taken to generate the page: 0.09110 seconds