New to PL/SQL and need help on check sum using ASCII function

Hello,
Need your expertise to help in figuring out how to write
code to calculate using ASCII function to return value for a character. For example ASCII('A') is 58. I want to do the check sum to sum-up the value for each character in the name. For example 'Jack'
Appreciate your help.
CK

Hi,
Please post all the technical queries in the respective forums. For more details and answers in SQL and PL/SQL, use the following forum:
PL/SQL
Sample PL/SQL code for your requirement:
-- make sure you have the serveroutput on using command.
-- set serveroutput on
DECLARE
sumval NUMBER(10);
tempval NUMBER(10);
colval VARCHAR2(20);
BEGIN
SELECT USER INTO colval FROM dual;
sumval := 0;
FOR i IN 1..LENGTH(colval)
LOOP
SELECT ASCII(SUBSTR(colval,i,1)) INTO tempval FROM dual;
sumval := sumval+tempval;
END LOOP;
DBMS_OUTPUT.PUT_LINE('sum is: '||to_char(sumval));
END;
The output of this pl/sql block will be:
sum is: 397
Please note: ASCII('A') is 65 and not 58.
Hope that helps.
Savitha.
http://otn.oracle.com/sample_code/content.html

Similar Messages

  • New to pl/sql and need help with procedure

    Hello there, I got two tables STAFF and BONUS which are not related by any constraints
    STAFF
    ID_NUMBER HIREDATE SALARY BONUS
    100020 12-MAY-03 13600
    100021 04-NOV-01 30000
    100022 08-APR-02 28000
    100023 08-APR-02 24000
    BONUS
    PERCENTAGE MORE_THAN_YEARS
    0.1 3
    0.15 5
    0.3 7
    0.45 9
    0.5 12
    I am trying to create a procedure that would calculate bonus based on years of employment according to bonus table.
    If employees sysdate -hiredate is greater than 5, he would get salary*0.15%....
    I created this procedure, but I got stuck here.
    I calculated the length of employment for every soldier using cursor in a loop, but I don't know how to get values from bonus table and connect them together.
    Please help me!
    create or replace
    procedure bonus_staff
    as
    cursor c1 is select *from staff;
    bon real;
    begin
    FOR ITEM IN C1
    LOOP
    bon := FLOOR(months_BETWEEN(SYSDATE,ITEM.hiredate)/12)*
    update staff
    set bonus = bon
    where id_number = ITEM.id_number;
    exit when c1%notfound;
    end loop;
    end;
    Thanks in advance..

    update staff
    set bonus = (select percentage
    from bonus
    where more_than_years = (select max(more_than_years)
    from bonus
    where more_than_years <= FLOOR(months_BETWEEN(SYSDATE,staff.hiredate)/12)
    You can do this in pure SQL, which operates on a set, so no PL/SQL is required.
    Sybrand Bakker
    Senior Oracle DBA

  • Just Bought New Mac Mini Server and Need Help on Migrating Old Single User

    This is for my home / home office The issue is I was unable to connect to my old computer using migration assistant for some reason, but I didn't want to go down a rabbit hole to figure it out.
    I would like to transfer all of my applications and prefs / settings to the new machine and I was thinking about using a synching program to do it so I wouldn't mess with the SL Server settings. I suppose I could do this manually but am concerned some hidden files or settings may not get moved properly. I am able to mount my old hard drive on the new mini so I just need a strategy. Thanks.

    Good question - my angst is subsiding as I type. I was concerned that my preferences and other application linked things like Application Support were the same as it was, but I suppose if I have to mess a bit with it upon opening or reinstalling a program is the worst thing that will happen. After going thru the list of programs I realize that like most people I regularly use about 15% of the things in my Applications folder. The biggest hassle is Adobe CS4 which I need to get reauthorized by Adobe and this could only have been solved if I de-authorized it before blowing out my earlier computer. Luckily that is worst issue I am encountering.

  • New to time capsule and need help with installing it?

    I just bought a new 3tb time capsule and  also new to apple routers I want to use this as my new wireless router how do I go about switching this out with my router now. Im using a linskys router now nothing special I think its only a 300Mbps the only problem is that we just  had our new house complete and prewired with ethernet connection in every room and a security system that runs off of the router how do I go about switching that set up to the new time capsule? I know if I had to have the company come out to do it they charge a hefty fee which I know its that hard to do the only thing that's stopping me is that set up to the security system I don't want to screw that up???

    Three different aspects
    1. Set the form up to submit the data (XML or FDF), not the full PDF. You can import the data to the PDF on your end.
    2. You can turn on Extended Reader Rights, but then limit the use/users to 500 by the EULA. The applicability of this option depends on your intended application. In a small office, it would be fine. For general web use you would likely exceed the limit and be in violation of the EULA.
    3. There may be an e-mail problem, one reason that e-mail is not recommended for form submission (even if the manual discusses it). Again, in a controlled environment like an office it will probably work fine, but in a web setup it is best to use a web script. There are 2 problems with e-mail that both depend on the client system (YOU have no control, but will be blamed in any case). First, the client machine has to be set up as an active MAPI client. Many folks do not have this on. Second, some e-mail clients treat PDFs like text and the result is a corrupt e-mail submission, even if it makes to you.
    If you have the possibility of web submission, do it. I suggest only having the form data submitted and not the form.

  • New to Photoshop (CS4Ext) and need help with basic loading of images to new folder.

    Just purchased CS4Ext and installed it. It's not showing up on my desktop as a quick entry icon. I want to simply load images from a portable hard drive (USB) to a new folder in photoshop so I can review them and begin to select  and separate out some of interest to manipulate  and share or get ready to print. It 's the most basic help one can need butI'm jut not clear on the workflow steps . Would appreciate someone walking me through the steps .
    Thanks much

    drmjp2 wrote:
    Just purchased CS4Ext and installed it. It's not showing up on my desktop as a quick entry icon.
    Let's see…   First of all, this is the Photoshop Macintosh forum.  Installed applications never, ever show up on your desktop as a "quick entry" icon on a Mac.  Are you on a Windows PC maybe?
    drmjp2 wrote:
    I want to simply load images from a portable hard drive (USB) to a new folder in photoshop so I can review them and begin to select  and separate out some of interest to manipulate  and share or get ready to print.
    Just select them with your mouse in the Finder and drag-copy them into the new folder.  Done.

  • I'm new to Solaris 10 and need help to setup ftp server

    hello!
    I just installed Solaris 10 and I'm trying to setup an ftp server (with ftpd) but I don't know how to do that
    my server doesn't need any security or authentication
    I'm looking for the default shared files directory
    Also wondering what to change in what configuration file...
    This OS looks quite similar to some linux I used before but the differencies are big enough to drive me crazy
    anyway thanks for your help.
    Any advice is welcome :-)

    cd /etc/ftpd
    vi ftpusers
    put a # in front of root and any other users that you wish to be able to ftp
    then svcadm restart ftp
    If you want to set up an anonymous ftp server, there is a little more involvement

  • New to Crystal reports and need help with formula

    Post Author: dausa
    CA Forum: Formula
    I will try to keep this short and sweet.
    Data comes from excel sheet and I am doing a outter left join.
    The need: IF the status is S or N, then i want it to sum the qty required for each part number.
    my formula looks like this;  If ({WIP_ORDER.STATUS}) = 'C OR N' Then SUM ({WIP_ORDER.QUANTITY_REQUIRED}, {ORIGINAL_.PART NUMBER})
    thanks for any help
    dausa

    Post Author: Manuel de Kleine
    CA Forum: Formula
    Dausa,You could use a formula like below:IF  ({WIP_ORDER.STATUS}) IN &#91;'C','N'&#93;THEN 1ELSE 0Now, you can do a SUM on this formula.

  • Am new to Adobe Pro and need help?

    1. When using text box identified as multi lines, how to cause text box to simply expand as you add rows rather than default to scroll feature? When I print out form I want to see all the input and scroll feature prevents that?
    2. In word or excel I can insert rows to cause words and shapes on a page to move down. Is there a way in this program to insert a blank row to cause what is below that row to move down?
    3. How do I copy the page 1 header so it repeats on all subsequent pages?
    Thank you

    Hi;
    I am assuming in these answers that all of this form authoring is in the FormsCentral desktop application included with Acrobat Professional XI...
    For #1: In the PDF the text box cannot expand as the user enters text, that is just how the PDF works outside of FormsCentral, it will scroll the text.  If you are using FormsCentral to collect responses you can "Download the Response as a PDF form" and it will look like the original form filled out, all the multi-line text fields are all automatically expanded to fit the text in this PDF so that you can print it out.  So, for the PDF users fill out, it scrolls, if they submit the data back to FormsCentral you can download that response as a PDF with expanded text fields.
    For #2: You can insert a formatted text field without entering any text, or insert a line and make it the same color as the background.  If you need to create a page break, make sure you are in "Page View" from the View menu to add page breaks for the PDF form and insert a page break there.
    For #3: You can add the same types of form elements that are in the header anywhere else in the form, insert a page break as described above and then add the image and/or text elements side by side for the header on each new page.
    Thanks,
    Josh

  • New to Adobe Forms and need help with Submit Email button

    I am new to Adobe Forms in Windows.  I created a form with a submit email button.  When users try to click the button, the message is operation cannot be completed.  My test user has Adobe Reader 9 installed.  I'm at a loss as to how to resolve the issue.  Please assist.  TIA!

    Three different aspects
    1. Set the form up to submit the data (XML or FDF), not the full PDF. You can import the data to the PDF on your end.
    2. You can turn on Extended Reader Rights, but then limit the use/users to 500 by the EULA. The applicability of this option depends on your intended application. In a small office, it would be fine. For general web use you would likely exceed the limit and be in violation of the EULA.
    3. There may be an e-mail problem, one reason that e-mail is not recommended for form submission (even if the manual discusses it). Again, in a controlled environment like an office it will probably work fine, but in a web setup it is best to use a web script. There are 2 problems with e-mail that both depend on the client system (YOU have no control, but will be blamed in any case). First, the client machine has to be set up as an active MAPI client. Many folks do not have this on. Second, some e-mail clients treat PDFs like text and the result is a corrupt e-mail submission, even if it makes to you.
    If you have the possibility of web submission, do it. I suggest only having the form data submitted and not the form.

  • I am very new to Mac Mini and need help transferring files to thumb drive

    I want to transfer the Mac Mini user guide (manual) to my thumb drive but do not find how to do it.  Help, please!

    The thumb drive is on the desktop.  This is the most embarrassing question I have had to ask in public in a long time, but, how do you drag something.  When I try by holding down my mouse on the file name I want to move it doesn't drag it just gives me several other options.  I left Microsoft for this and I know nothing about Apple computers except for my iPad.

  • Am new in multi sim and need help

    how can i find the current and the Voltage between a and b ?
    Attachments:
    cuurrent and Vab.ms10 ‏47 KB

    I have your circuit with the meters in place for you to examine. I believe this set-up to be accurate. You can not check current from your point a and b. you have to check it in each branch. You can check the voltage at point a and b. Also, in your circut, there was no ground. Multisim requires at least one ground in order to simulate and it doesn't matter in this case where you put it. This is just a reference for measurement that is required for Multisim.
    There are other ways to measure this. You could do it with the multimeters, measurement probes if your version has this option or the way I did it with the ammeters and voltmeters under the INDICATORS tab in the component toolbar.
    Don't be too concerned about the negative readings on the ammeter. That just indicates that I placed them in the circuit with the wrong polarity and current is flowing against them. I really just forgot to place them in the correct direction
    I will let you look at this and hopefully it will match any calculated results you may have come up with.
    Message Edited by lacy on 12-10-2007 06:18 PM
    Kittmaster's Component Database
    http://ni.kittmaster.com
    Have a Nice Day
    Attachments:
    Voltage and Current Measurements.ms10 ‏61 KB

  • Help, new to Linux and need help installing 8i

    I am new to Linux and some of this stuff..
    Yet,I have gotten the JDK116_v5 installed and working on my box.
    I have cut a cd for Oracle8i and need help..
    I have also recopiled my kernal as well...
    Does any one know where I can get help...
    null

    Al Pivonka (guest) wrote:
    : I am new to Linux and some of this stuff..
    : Yet,I have gotten the JDK116_v5 installed and working on
    : my box.
    : I have cut a cd for Oracle8i and need help..
    : I have also recopiled my kernal as well...
    : Does any one know where I can get help...
    Try http://www.akadia.com/html/dod-frame.html for Redhat.
    http://www.suse.de/~mha/oracle/ for SuSE
    Also peruse these
    http://www.akadia.com/html/dod-frame.html
    http://jordan.fortwayne.com/oracle/
    Colin.
    null

  • I am setting up a new iMac and need help syncing files to Dropbox.  On my old computer I had it set where when I saved a document, it was saved on my hard drive, as well as to a folder in Dropbox.  I can't remember how I set this up.  Any help?

    I am setting up a new iMac and need help syncing files to Dropbox.  On my old computer I had it set where when I saved a document, it was saved on my hard drive, as well as to a folder in Dropbox.  I can't remember how I set this up.  Any help?

    The way that Dropbox works is that it keeps a copy of all your files in your local Dropbox folder on your hard drive (which is, by default, directly under your home folder). Adding files to that folder will sync them to the Dropbox server.
    You do of course have to download the Dropbox application to enable this (download link at the top right of http://dropbox.com ).
    Matt

  • Screen freezes and popup message says I need to do a shutdown and then restart.  It does it sometimes 2 times a day. Im new to apple and need help.

    My screen freezes and popup message says I need to do a shutdown and then restart.  It does it sometimes 2 times a day. Im new to apple and need help.

    Bad or incompatible RAM is, more often then not, the cause of most Kernel Panics. It could also just need to be reset.
    Here's the most used site for Resolving Kernel Panics. Please do all the steps in order, even if you don't think you need to do a certain step.
    Here is a great MacFixIt article.
     Good Luck!
    DALE

  • I have a new macBook Pro 15 and need to purchase best, easiest usb for backup - help please

    I have a new MacBook Pro 15" and need to purchase the easiest, cost-effective USB for backup.  I have never done a backup and don't know what to buy.  Thanks much from an obvious novice.

    Look at these two links to OWC products.  Note that one is for enclosures only so an appropriate HDD would have to be added.  This at least should give you an idea of what is available.
    http://eshop.macsales.com/shop/USB2/OWC_Express
    http://eshop.macsales.com/shop/firewire/on-the-go
    Ciao.

Maybe you are looking for