| 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 |
Send this thread to your friend |