Home » SQL & PL/SQL » SQL & PL/SQL » Help 2 Oracle scripts
Help 2 Oracle scripts [message #208883] Tue, 12 December 2006 07:25 Go to next message
Anto318
Messages: 27
Registered: December 2006
Junior Member
Hey all I have to write a special script to look for a string within a string and everytime I write one all that I get is 0.

Also I need to write a script that rounds a variable to the next highest multiple of a supplied number

e.g. 5 give 5,10,15 from 3,9,12

I can't figure this out I tried searching the web but im just useless at this stuff and got landed with it for my project.

My only other one is a special script that will find a string within another

e.g. Find the position ra from oracle will give 2

I'm sorry to be annoying ye about these things but I have spent the last couple of days tryin to figure these out and not for the life of me can I.

I hope ye can help me
Thanks in advance
Re: Help 2 Oracle scripts [message #208887 is a reply to message #208883] Tue, 12 December 2006 07:45 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
When you say 'Create a script', are you looking to have a script to run against the database to update some tables, or a function that you can call from somewhere?

If you post the code that you've got so far we'll get a good idea of what you're trying to do, and can hopefully fix it for you.
Re: Help 2 Oracle scripts [message #208888 is a reply to message #208883] Tue, 12 December 2006 07:50 Go to previous messageGo to next message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
If INSTR returns zero, it means it didn't find the string you are looking for. Bear in mind that they have to match exactly - capitalisation, spaces etc.

You could achieve the effect of rounding to 5 by doubling the supplied number, rounding to 10 and then dividing by 2:

select round(6*2, -1)/2 from dual

gives 5

select round(14*2, -1)/2 from dual

gives 15
Re: Help 2 Oracle scripts [message #208890 is a reply to message #208883] Tue, 12 December 2006 07:55 Go to previous message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
Or maybe this would meet the requirement better:

select ceil(3/5) * 5 from dual

select ceil(9/5) * 5 from dual

select ceil(12/5) * 5 from dual
Previous Topic: Logging Key Values during FGA
Next Topic: Variable passing please explain difference between T-SQL and PL/SQL
Goto Forum:
  


Current Time: Sun Dec 04 18:48:19 CST 2016

Total time taken to generate the page: 0.09091 seconds