Not able to print the value of the variable

I wrote the code below

create or REPLACE PROCEDURE ARMSTRONG_NUMBER_a
as


arm_num number :=371;
num_len number:=0;
a number:=0;
b number:=0;
c number;
BEGIN
num_len := length(arm_num);
for i in 1..num_len
loop
DBMS_OUTPUT.put_line('VALUE of i ' || i );
b:= substr(a,i,1) ;
DBMS_OUTPUT.put_line('VALUE OF b ' || b );
end loop;
end;

Hello

Rahul_India wrote:

I wrote the code below

  1. create or REPLACE PROCEDURE ARMSTRONG_NUMBER_a
  2. as
  3. number of arm_num: = 371;
  4. num_len number: = 0;
  5. a number: = 0;
  6. b number: = 0;
  7. c number;
  8. BEGIN
  9. num_len: = length (arm_num);
  10. because me in 1.num_len
  11. loop
  12. Dbms_output.put_line ('VALUE of i' | I);
  13. b: = substr (a, i, 1);
  14. Dbms_output.put_line ('VALUE OF b' | b);
  15. end loop;
  16. end;
  1. O/P
  2. anonymous block filled
  3. VALUE of i 1
  4. VALUE OF b 0
  5. I VALUE 2
  6. VALUE OF b
  7. I VALUE 3
  8. VALUE OF b

I should get the O/P as

anonymous block filled

VALUE of i 1

VALUE OF b 3

I VALUE 2

VALUE OF b 7

I VALUE 3

VALUE OF b 1

This is the output that I would expect if line 15 has

b: = substr (arm , i, 1);

but not when you take the character of the i - th one.

Moreover, if one (or arm) and b are numbers, then you can consider using number functions, like TRUNC and MOD, might be a better way to get individual numbers - assuming that you really need to get the individual numbers.  It is often a symptom of a bad design, where the number is actually a composite of what must be in multiple separate columns.

SUBSTR expects its first argument to be a string.  If you really must call SUBSTR, then its better to ouse TO_CHAR to explicitly convert the number of strings.

Tags: Database

Similar Questions

  • not able to print the value of the url (aaa #bbb)

    Hello

    I am not able to print the < cfoutput > #url.xyz # < / cfoutput >

    Here, the url.xyz in the url value is aaa #bbb

    It is printing only aaa

    You should have url-encoded query from the beginning chain. Given that you don't have, Coldfusion ignored everything in the query string that comes after the character #. To fix this, replace the character # % 23. . In other words, .

    Another rule is that we should avoid the occurrence of the character # in a string. Thus, the correct value to cfoutput is "aaa ##bbb". To get and display code that is



    #url_xyz #.

  • Not able to print the PDF with firefox 29,0 Preview pdf plugin. Why?

    Not able to print the PDF with firefox 29,0 Preview pdf plugin. Why?

    The 29.0.1 firefox solved my problem!

    Please check: Firefox-> Preferences-> tab-> applications (option) Portable document Format (PDF)-> Preview in firefox

    Good luck!

  • Not able to print the decimal values in a table

    Hi all

    I created an application. Here, I have a table with three columns Col1 and col2 are numbers and col3 is the diffrence between col1, col2.

    I use AJAX and JavaScript to calculate the difference in a dynamic way.

    I am able to print the difference as for example:-1, 2, 1.5-1.5. but not 0.8, 0.8, 0.1 etc...

    If col1 col2 = 1.2 - capable of printing

    If col1 to col2 = 0.2 - error, unexpected token

    error_07012016.PNG

    -Code AJAX:

    Declare  
      p_curr  number;  
      p_prev    number;  
      p_diff number;  
    Begin  
      p_prev    := to_number(apex_application.g_x01);  
      p_curr    := to_number(apex_application.g_x02);  
      
       
      SELECT to_number(p_curr - p_prev) into p_diff  
      from dual;  
      
      -- return calculated value
      sys.htp.p(p_diff);  
    End;
    

    -JavaScript: running the loading of the page

    function f_calulate_duration(pThis) {  
    
      var row_id     = pThis.id.substr(4);  
      var s          = $('#f18_'+row_id).val().replace(/[^\d.-]/g, ''); 
      var curr       = $(pThis).val().replace(/[^\d.-]/g, ''); 
    
    if(!s){
      var s= 0;
      var prev = s;}
    else{
      var prev = s;}
    
    apex.server.process 
    ( "CALC_DIFF", { x01: prev, x02: curr }, 
    { success: function( pData ) { 
    $('#f23_'+row_id).val(pData);}}
    );  
    }  
    

    Please suggest the solution to this.

    Oracle Apex Version: 4.2.

    Thank you

    Dev

    Hello

    I don't get the point to use the expensive AJAX call to the database, instead you can have the same functionality with JavaScript code below.

    function f_calulate_duration(pThis) {
      var row_id     = pThis.id.substr(4);
      var s          = $('#f18_'+row_id).val().replace(/[^\d.-]/g, '');
      var curr       = $(pThis).val().replace(/[^\d.-]/g, '');   
    
    if(!s){
      var s= 0;
      var prev = s;}
    else{
      var prev = s;}
    
    var diff = 0;
    diff = curr - prev;
    var n = diff.toFixed(2);
    alert(n);
    $('#f23_'+row_id).val(n);  
    
    //-- Remove this code
    /*apex.server.process
    ( "CALC_DIFF", { x01: prev, x02: curr },
    { success: function( pData ) {
    $('#f23_'+row_id).val(pData);}}
    );*/
    
    }    
    

    Thank you

    D

  • Not able to print the message after redirection to another page of pag current

    Hi Experts,

    I'll call you a procedure (who accepts 4 parameters IN) page of the OAF by pressing a button.

    My page contains: 4 elements of text Message and the other present button.

    I enter values in the 4 message text of introduction of the elements; After clicking on the button submit, he calls with success the procedure.*After by clicking on the button submit, after the call to procedure, I would like to pass on the same page with the values parameter zero and display confirmation message *.

    But I am not able to make the parameter null values in the page.


    I have the code in my page controller below.

    REQUEST FORM PROCESS:

    OAApplicationModule oa = pageContext.getApplicationModule (webBean);


    {if (PageContext.GetParameter ("Submit")! = null)}
    CallableStatement call_proc = null;
    try {}
    call_proc = OA.getOADBTransaction () .createCallableStatement ("start oaf_test_tbl_insert_proc(:1,:2,:3,:4,:5); end; ", 5) ;
    call_proc. SetString (1, PageContext.GetParameter ("empno"));
    call_proc. SetString (2, PageContext.GetParameter ("Ename"));
    call_proc. SetString (3, PageContext.GetParameter ('Work'));
    call_proc. SetString (4, PageContext.GetParameter ("Salary"));
    call_proc.registerOutParameter(5,types.varchar);
    call_proc. Execute();
    oa.getOADBTransaction () .commit ();

    String message = call_proc.getString (5); out parameter (5) will return a message


    OAException message = new OAException (message, OAException.CONFIRMATION);
    pageContext.putDialogMessage (message);

    pageContext.forwardImmediately ("OA.jsp?page=/practice_test_prc1/oracle/apps/mfg/simplepg/webui/oaf_test_tbl_calling_proc"
    null
    OAWebBeanConstants.KEEP_MENU_CONTEXT
    null
    null
    true
    (null);

    } catch (SQLException e) {}
    call_proc. Close();
    }

    }


    Kindly help me, how to print the confirmation message and send to the same page by making the param to null values.

    Hello

    On the successful return of the procedure, you must set a session Variable * (pageContext.putSessionValue ("WFFullListPage") *.)

    Then call it.

    pageContext.forwardImmediately ("OA.jsp?page=/practice_test_prc1/oracle/apps/mfg/simplepg/webui/oaf_test_tbl_calling_proc"
    null
    OAWebBeanConstants.KEEP_MENU_CONTEXT
    null
    null
    true
    (null);

    Next, you need to check this condition on the PR of the CO and show the message as required.

    Extract the same value to the controller, as * (pageContext.getSessionValue ("WFFullListPage") *)

    Kind regards
    GYAN

  • WPSM54G cannot find print server and not able to print the test page

    After several days of trial and error I am so far I'm willing to give up and put this peace of equipment for sale. It is my last attempt to find a solution.

    I have a Canon MP510 printer connected to the print server and I managed to configure the print server so that it establishes a wireless connection to the router. I can see the ip address assigned to my router print server and I can log on to the configuration of the print server page.

    When I want to set up your computer (software print copy of the Canon MP510 print server) I can not complete the wizard. Step 1 is successful. It shows the print server and the MP510 related to port 1, but in step 2, I get a message that the print server can not be found.

    I looked on the forums how to solve. I already tried a fixed ip address to configure the printer manually but not any which solution worked.

    Your print server must be set to a fixed IP address, try this IP address: 192.168.1.78... Disconnect ethernet cable between your router and the PS... Both devices power for one minute cycle... Follow the link here after changing the IP address on the PS...

  • not able to print the PDF file, refused permission for the passport application?

    I try to print a DS 82 to use an application for renewal of Passport online. When I get to the printing part he refuses saying that I don't have permission to print this page. Any tips? It's my computer, and I went through the security sections in the Panel. I use Windows 7 Pro

    What browser are you using, IE?

  • OfficeJet 6600. Works as a printer, but not able to start the scanner.

    OfficeJet 6600. Works as a printer, but not able to start the scanner.

    I am facing a strange behaviour of my camera. I tried to find similar problems on the forum, but did not succeed.

    I started it 2 days (near my 5610 old which seems to have problems of aging). I use a Sony VAIO PC, OS Win7-Pro, updated.

    Running the appliance following the instructions of the poster. Presents the installation CD. Wireless net was successful and the screen of the device is to give the corresponding IP address.

    But this IP has realized the configuration SW is not recognized. I tried thousands of times, switching and on different devices (router, printer and pc) in the order required, uninstall and reinstall the device.

    However, despite the property intellectual not recognized the device functioning as a "printer".

    But I need to use it as a scanner.

    Procedure by selecting the "scan to PC" screen of the device (only available as an option) I get the message "to ensure that the feature is turned on" and I am prompted to 'open the printer HP SW,... '. ».

    Go to Windows and by clicking on "HP SCAN" in the HP/HP Officejet 6600 directory I get the a warning window stating "HP Officejet unidentified 6600.

    Can someone, please?

    Thank you in advance.

    Hey,.

    Try this document! A "no computer has detected" or "Connection error" message when scanning for HP Officejet 6600 e-all-in-one and 6700 Premium e-All-in-One Printer Series (H711)

    Have a great day!

  • I am able to scan, but unfortunately not able to print on the printer DJ1515.

    Original title: Do not print to the printer.

    My DJ1515 printer after the success of the download, I was able to scan, but unfortunately not able to print. Need help how to solve this problem. Thank you

    You need to provide a little more information... and it is unclear what you mean by "after successful download" even though I think you mean that you believe that you have successfully installed the printer.

    Is your printer: http://h10025.www1.hp.com/ewfrf/wc/product?cc=lamerica_nsc_carib&dlc=en&lang=en&lc=en&product=5385208 (this model seems to be sold in Latin America and the Caribbean)?

    What version of Windows (XP Home, XP Pro, etc.) and service pack (none, 1, 2, 3) do you have?  Do right click my computer and select properties for info.

    Your printer is connected to your computer by USB, correct?

    When you installed the printer did you leave the printer NOT connected until you are prompted to connect by the installation software or did you first connect the printer to the computer and then install the software?

    What happens when you try to print? If you get an error message, please provide the full text without paraphrase.

    Please describe the status of the lights on the front of the printer (on/off/flashing).  Lights are on 1, 5 and 6 in the figure below:

    Click Start > printers and faxes
    Is there an icon for your printer?  If Yes, it looks like the following (except with the name of your printer instead of "hp Laser Jet 1300 PCL" 5th)?


    It's

    • Is there a circle with a check mark?
    • Is there a 0 in the second row?
    • The third line says 'ready '?

    What happens if you right cliquer click on this icon, select properties and then click on the button "Print Test Page"?

    What happens when you follow these steps:

    • Click Start > all programs > HP > HP Deskjet 1510 Series > Series HP Deskjet 1510 (note that the wording in your Start Menu may show instead of 1510-1515)
    • When the printer software opens, click on 'Print and scan' and then click on "maintain your printer.
    • When the printer Toolbox opens, click on 'Print the diagnostic information' in the tab 'device reports.
  • I can print Microsoft Word and Excel documents, but I am not able to print from the web. I get an error message that says: "Activation - Code 20' - error"Printer Not Activated".

    Activate printer F4580

    I run Microsoft Vista.  I have a printer HP F4580.  I can print Microsoft Word and Excel documents, but I am not able to print from the web.  I get an error message that says: "Activation - Code 20' - error"Printer Not Activated".  What should I do to correct this?

    Hello

    ·          What browser do you use to connect to the Internet?

    The error may occur if the wrong printer is set as default, the printer driver printer is missing, or if there are conflicts in Device Manager.

    Step 1: Make sure that the desired printer is set as the default printer:

    http://Windows.Microsoft.com/en-us/Windows7/change-your-default-printer

  • Printers / HP Photosmart 5520: my printer asked a password am not able to find the password or reset an another pls help

    my printer was asking a password am not able to find the password or reset an another pls help

    I've used it since December when I bought the printer, but I just changemy internet company

    It was when he said ask for password which i don't remember not pls help.

    I can be paid to [personal information deleted]

    Hi @funmi09

    I want to help you set up your printer for your internet company recently changed. This document provides the steps necessary to find the WEP key or WPA or your wireless network password.

    Once you retrieve your password, the following will help you to configure the printer; Connection of the printer after you have changed your wireless network.

    If you still can't find your password, you will need to contact your ISP (internet service provider).

    I hope this helps.

  • Not able to get the value of the type defined in the other program

    Hi all

    I have create a type in a single package spec (Globally), now I'm using the same type in another package. Simply I'm calling the first package and try to store the value in the Type and use the same type in the second package.

    But I'm not able to get the value

    Type declaration

    Declared in package Spec
    
    TYPE t_aa_derive_tbl_type IS TABLE OF xxxx%ROWTYPE;
       t_aa_derive t_aa_derive_tbl_type;
    

    Package 1

    Package1. PROCEDURE name(
    some parameters);
    is
    Cursor
    c1 is Select * from dual;
    
    begin
          OPEN c_aa_derive;
            FETCH c_aa_derive
            BULK COLLECT INTO t_aa_derive;
            CLOSE c_aa_derive;
           
         END get_aa_derive;
    

    In my second package

    I'll call you

    Package1. PROCEDURE name(
    some parameters);
    
    and then i am trying to
    
    for i in 1 .. package1.t_aa_derive.COUNT
      LOOP
    
    ....
    
    ....
    ...
    
    end loop;
    

    I can not entered the loop for some reason any.

    Could someone guide me if anything I missed.

    See you soon,.

    San

    And what did you like refcursor c_aa_derive in the call to package1.name? Is it returns all rows? If this isn't the case, COUNT will be 0.

    SY.

  • Not able to see the value of the item description-&gt; main classification

    Hello group,

    I configured the responsibility of China. From now on, I'm not able to see the lov primary classification in the item Description screen.

    China HRMS Manager-> Total Compensation-> Description-> primary Classification (column) element the only value that is gathering is "initialization of balance."

    Where we, the responsibility, I am able to see more options. Can someone suggest me the reason for the same.

    Thank you

    It's 11.5.10 version

    Hi please refer to the below metalink note...
    566421.1 setting form element has a single value in the primary Classification balance initialization
    See you soon
    Ganesh

  • I have portable printer HP Officejet 100 and I'm not able to load the driver BT software what is the problem?

    I'm not able to add the BT drivers, your help would be appreciated. Thank you

    You are welcome.

    Please follow the steps below to set up the Bluetooth connection:

    http://support.HP.com/us-en/document/c02652212

    If you do not have the installation CD, you can download the software below:

    http://ftp.HP.com/pub/softlib/software12/COL36711/bi-90383-2/OJ100ML411_Full_14_en.exe

    Please let me know of any problems, all available details (for example, specific error message unique behavior)

  • I would use Yuanti SC police for my web development project. However, my developer is not able to use the file .ttc I extracted from the library of fonts, and .ttf, .otf .woff formats not available anywhere on the web.

    I would use Yuanti SC police for my web development project. However, my developer is not able to use the file .ttc I extracted from the library of fonts, and .ttf, .otf .woff formats not available anywhere on the web. Please, let me know how can I use this font for my project.

    Thank you

    Anton

    Unless the site you develop is for the Asian market, I don't know why you want to use that particular font. The Basic, standard and digital alphabet punctuation glyphs has sans serif, Roman characters, but the rest is thousands of Kanji characters. While you can use the font .ttf and .otf and web fonts, it would be very unusual to use one so great. Pages should load quickly and 78 MB, with a value of faces to download for those who have connections slow Internet is not fast.

    I would take a different font without serifs. There are literally thousands who look identical or virtually identical to Yuanti.

    131 free and high quality without font serif to choose here. I'm sure you can find a desired.

Maybe you are looking for

  • Download directory in my vehicle

    I was unable to download all of my home directory in SYNC of my car

  • Slightly OT - access my apps purchased on the new phone

    Please bear with me; I am an older woman trying to wrap my brain around some of the latest technologies. I'm quick to learn, but need a little coaching. I believe someone here can probably help me navigate my last challenge... and for this, I would h

  • WINDOWS LIBRARIES HAVE STOPPED WORKING.

    libraries of widows have ceased to work, no option for delete & restore the default settings in windows 7. can access music & photos through different programs, but carnt find or open documents. ideas please, have some important documents.

  • creating screens

    I've demonstrated, creating an application with help forum and guides, however, hit a problem with regard to the screens.  My application is configured as follows, import net.rim.device.api.ui.*; public class loginMain extends UiApplication { public

  • Download and install the new searchindexer.exe?

    I was so frustrated by slow computer I deleted searchindexer.exe.  Now I need a bureau researcher.  I can't find a download on the microsoft.com site, and I don't have the disks with this computer, even if it's a legal copy of windows 7 64.  I would