Impossible..................Possible............ [message #370766] |
Thu, 03 February 2000 00:46 |
Cynthia
Messages: 18 Registered: February 2000
|
Junior Member |
|
|
To all OCP's,
Q) Here by I had given some examples for the output?
ex1) I give a string : ABCD
The output will be:
........A
......ABA
....ABCBA
.ABCDCBA
....ABCBA
.......ABA
.........A
ex2) I give a string : ABCDEFGHIJKL
the output will be the same as of to ex1.
Thanks in advance,
Cynthia..
|
|
|
Re: Impossible..................Possible............ [message #370768 is a reply to message #370766] |
Thu, 03 February 2000 08:00 |
Atavur Rahaman S.A
Messages: 23 Registered: January 2000
|
Junior Member |
|
|
Hi,
I have written a PL/SQL code for ur query... Check it out... It's compatible on any Oracle Platforms.
PL/SQL Block....
----------------
Declare
var1 varchar2(160);var2 varchar2(60);
var3 var2%type:=chr(9)||chr(9)||chr(9)||chr(9)||' ';
var4 var2%type:=' ';var5 var2%type;
cnt1 number:=1;cnt2 cnt1%type;cnt3 cnt1%type;
cnt4 cnt1%type;cnt5 cnt1%type;
knt1 cnt1%type:=1;
Begin
var2:='&var2';
cnt2:=Length(var3);
/* Loop to Reverse the String............*/
For dummy in reverse 1..Length(var2) Loop
var4:=var4||substr(var2,dummy,1);
end loop;var4:=var4||' ';knt1:=Length(var4);
/* First Loop for the Ist Quadrant..... */
while cnt1 <= LOOP<BR LENGTH(VAR2)>var1:=substr(var3,1,cnt2)||Substr(var2,1,cnt1)||substr(var4,knt1,cnt1);
Sys.dbms_output.put_line(var1);
cnt1:=cnt1 + 1;cnt2:=cnt2 - 1;knt1:=knt1 - 1;
End Loop; cnt4:=cnt2 + 2;cnt5:=Length(var2)-1;
/* Second Loop for III quadrant......... */
cnt1:=4;
While cnt5 > 0 Loop
var1:=Substr(var3,1,cnt4)||substr(var2,1,cnt5)||substr(var4,cnt1);
Sys.dbms_output.put_line(var1);
cnt4:=cnt4 + 1;cnt5:=cnt5 - 1;cnt1:=cnt1 + 1;
End Loop;
end;
/
Don't Underestimate any ORACLE CERTIFIED PROGRAMMERS..... I think by this...You would have got it what an Oracle Certified Programmer is .......Anything else....
Atavur Rahaman
|
|
|