Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> Functions and conversions

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Functions and conversions
 Burton  Posted: Feb 09, 2007 02:51:57 PM

 Total Post: 53
 Joined: Dec, 2006






 I need some help!
Help!
I have been given a bunch of questions, answered them all, except these three. ANY advice much appreciated.

Use SQL built-in function to convert the followings.
String, ‘both the UPDATE commands and the ALTER TABLE command’

1.Remove ‘UPDATE’ and ‘ALTER’ from the string.

2.Find out the position of ‘a’ of ‘and’ in the string.

3.Convert ‘abcd’ to $9999

I need some tips on these, or atleast a good URL where I can start.
Cheers.
B.

 Jayanta
Posted: Feb 09, 2007 03:39:43 PM  

 Total Post: 479
 Joined: Feb, 2006






 
in ur study mat or book that u have purchased, go for instring and subsstring function.
regards


 Burton
Posted: Feb 09, 2007 04:02:36 PM  

 Total Post: 53
 Joined: Dec, 2006






 
This is what I have done for the removal task. It's just a twist on REPLACE, though I's sure there might be a more elegant approach.

Remove ‘UPDATE’ and ‘ALTER’ from the string.

SQL> SELECT REPLACE
('both the UPDATE commands and the ALTER TABLE command', 'ALTER' , ' ')
FROM DUAL



SQL>SELECT REPLACE
('both the UPDATE commands and the ALTER TABLE command', 'ALTER' , ' ')
FROM DUAL

 Oracle Virus
Posted: Feb 10, 2007 06:51:47 AM  

 Total Post: 50
 Joined: Jan, 2007






 
Hi Burton,
I went through your questions. I thought you can do it using substring as jayanta told. But about converting $9999 to 'abcd', I went through some article long back. It was nothing but just wrapping of the data.

1. If you are deploying a project, then you have to wrap the procedures, if in that case you want to convert your logic to unknown code, just use the wrap command. If details are required regarding this, kindly post ur comments down. You can wrap only procedures not functions, as u are speaking regarding functions just go through the point below.

2. If you are sending some confidential data to client, then you have to encrypt and send it to client which most banking projects will do. The credit card numbers and the transactions info will be encrypted. This syntax I am not sure as of now. I suggest you to search google with the keyword 'encryption (of data) in Oracle.'

Regards.
Anil Kanuri.

 Burton
Posted: Feb 10, 2007 02:33:46 PM  

 Total Post: 53
 Joined: Dec, 2006






 
Yes thanks, I did the position finding task with this

SQL>SELECT INSTR ('both the UPDATE commands and the ALTER TABLE command', 'and', 1, 1) "FIRST POSITION OF and
2* FROM DUAL

which gave me:
FIRST POSITION OF and
---------------------
21

TO convert ‘abcd’ to $9999, I have been told to take my pick of the functions provided. They are:
TO_CHAR
TO_NUMBER
TO_DATE
TRANSLATE
as well as all the group functions.

I continue the quest...
B.

 Burton
Posted: Feb 10, 2007 08:33:22 PM  

 Total Post: 53
 Joined: Dec, 2006






 
Everything is solved now, except the rather cryptic last question:
"Convert ‘abcd’ to $9999"

I have scoured the Oracle site for information about TO_NUMBER, and as one other asked me, 'what exactly does 'convert ‘abcd’ to $9999 ' really mean??

Not sure, have asked he who set the question. If he gets back to me I will post a solution here.
Thanks.
B

 Oracle Virus
Posted: Feb 11, 2007 07:40:28 AM  

 Total Post: 50
 Joined: Jan, 2007






 
Sure Burton, Waiting for the solution.

and meanwhile i guess encrypt is the only option to do that. Lets see their reply.

Regards,
Anil Kanuri.

 Burton
Posted: Feb 11, 2007 07:44:05 AM  

 Total Post: 53
 Joined: Dec, 2006






 
Here it is.
Convert ‘abcd’ to $9999

1 SELECT TRANSLATE ('abcd ', 'abcd ', '$9999')
2* FROM DUAL


 Oracle Virus
Posted: Feb 11, 2007 02:24:46 PM  

 Total Post: 50
 Joined: Jan, 2007






 
Ok..Thanks Burton...I appreciate it!!

Regards,
Aneel Kanuri.

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Vinoth Kumar357
  Gopu Gopi340
  Gitesh Trivedi322
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software