Home > database >  Oracle PL/SQL, please output all the daffodil number between 100-999.
Oracle PL/SQL, please output all the daffodil number between 100-999.

Time:09-18

 declare 
A number:=0;
Number: b=0;
Number: c=0;
The begin
For I in 100.. 999 loop
A:=mod (I, 10);
B:=mod (I/10, 10);
C:=mod (I, 100);
If (a * a * b + a + b * b * c * c * c)=I then
dbms_output.put_line(i);
end if;
end loop;
end;


Turn to the great god, why didn't I write this SQL output ah, thank you, the right should be how to write

CodePudding user response:

 
B:=mod (trunc (I/10), 10);
C:=trunc (I/100);

CodePudding user response:

 select t1. Lv 
The from (select level lv from dual connect by level & lt; T1=999)
Start with t1. Lv & gt;=100
Connect by the prior t1. The lv=t1. Lv
And level & lt;=length (t1. Lv)
And the prior sys_guid () is not null
Group by t1. Lv
Having a t1. The lv=sum (power (substr (t1. Louis vuitton, level 1), length (t1. Lv)))
The order by t1. Lv
;

Declare
A number:=0;
Number: b=0;
Number: c=0;
The begin
For I in 100.. 999 loop
A:=mod (I, 10);
B:=mod (floor (I/10), 10);
C:=floor (I/100);
If (a * a * b + a + b * b * c * c * c)=I then
dbms_output.put_line(i);
end if;
end loop;
end;

CodePudding user response:

This condition does not meet the
If (a * a * b + a + b * b * c * c * c)=I
  • Related