Prepare for your Next Interview
This is a discussion on vertical printing within the SQL forums, part of the Databases category; select substr('geek interview',rownum,1) from user_objects where rownum can u explain the word by word meaning. substr('geek interview',rownum,1)----here rownum value is?-------------------- trim(geek interview )...
|
|||
|
vertical printing
select substr('geek interview',rownum,1) from user_objects where rownum<=length(trim('geek interview));
can u explain the word by word meaning. substr('geek interview',rownum,1)----here rownum value is?-------------------- trim(geek interview )gives-----------? total query gives what |
| Sponsored Links |
|
|||
|
Re: vertical printing
Dear Jayanth,
Trim removes trailing and leading blank spaces. legth return the length of a string. substr(src,p,l) :- Retruns a portion of src starting at position p and l caharacters long. I already given explanation to rownum and rowid for your last posting. All these are simple functions for which you can find explanation in any text book or reference material. If you find it difficult to understand entire query at a time split it into small queries, execute each query seperately as follows and see the result. select trim('geek interview') from dual; select length(trim('geek interview')) from daul; select substr('geek interview',2,1) from dual; Then it will become easy for you to understand the output of following query. select substr('geek interview',rownum,1) from user_objects where rownum<=length(trim('geek interview')); Execute the above queries and find the output yourself . Regards Krishna |
|
|||
|
Re: vertical printing
substr('geek interview',rownum,1) what itgives.
ex. substr('jayanth',3,4);her 2nd parametr is 3. gives' yant' right. but in substr('geek interview',rownum,1) 2nd parametr rownum value is dont mine i did not understand the concept of rowid, row num .can u give detail exmple for that |
|
|||
|
Re: vertical printing
Dear Jayanth,
For each row returned by a query, the ROWNUM returns a number indicating the order in which Oracle selects the row from a table . The first row selected has a ROWNUM of 1, the second has 2, and so on. For example let us suppose there are fourteen records in EMP table and you want to display first ten records from the table then you may use the following command. Select * from emp where rownum <=10; In this query select substr('geek interview',rownum,1) from user_objects where rownum<=length(trim('geek interview)); Length(trim('geek interview')) returns value 14. So it becomes becomes select substr('geek interview',rownum,1) from user_objects where rownum<= 14; The above query returns 14 rows. For the first row rownum is 1 Substr('geek interview', 1, 1) retruns G. For the second row rownum is 2 Substr('geek interview', 2, 1) retruns E and So on. I hope now it is clear to you. Regards Krishna |
| The Following User Says Thank You to krishnaindia2007 For This Useful Post: | ||
|
|||
|
Re: vertical printing
USER_OBJECTS describes all objects owned by the current user
objects are tables,views,tiggers,packages,sequences,procedures,functions |
| The Following User Says Thank You to susarlasireesha For This Useful Post: | ||
|
|||
|
Re: vertical printing
Quote:
from this example u can find the difference of Length(trim('geek interview')) select Length(trim('geek interview')) from dual returns 14 select length('geek interview') from dual; returns 14 but if i give space in beginning of geek interview then select Length(trim(' geek interview')) from dual returns 14 but select Length(' geek interview') from dual return 15 |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Print management system that gives you control over all of your printing resources, p | JobHelper | Geeks Lounge | 0 | 01-03-2008 11:50 AM |
| How can we use thermal printer for bar code printing | Geek_Guest | Oracle | 1 | 07-17-2007 08:30 AM |