Nested blocks

hi
i am new user for oracle .i want know about pl/sql block
can i write this
DECLARE
     V_tEMP1 VARCHAR2(20) ;
BEGIN
     V_tEMP1 := 'SECOND BLOCK';
     DBMS_OUTPUT.PUT_LINE(V_tEMP1);
          CREATE OR REPLACE PROCEDURE SP_TEST
          IS
          V_tEMP VARCHAR2(20) ;
          BEGIN
          V_tEMP := 'FIRST BLOCK';
          DBMS_OUTPUT.PUT_LINE(V_tEMP);
          END ;
END ;
or only i call procedure
Edited by: abdul moyed on Jun 24, 2009 12:26 AM

This function go in DECLARE without "CREATE OR REPLACE"
DECLARE
  V_NUMBER VARCHAR2(8);
  PROCEDURE SP_TEST
  IS
    V_tEMP VARCHAR2(20) ;
  BEGIN
    V_tEMP := 'FIRST BLOCK';
    DBMS_OUTPUT.PUT_LINE(V_tEMP);
    DECLARE
     V_tEMP1 VARCHAR2(20) ;
    BEGIN
      V_tEMP1 := 'SECOND BLOCK';
      DBMS_OUTPUT.PUT_LINE(V_tEMP1);
    END ;
  END ;
BEGIN
  SP_TEST;
END;
/

Similar Messages

  • Cursor Variable in Nested Block

    Dear all,
    I have a package that has procedures that open cursor variables and print the queries of sample schema HR. There's one procedure that opens the cursor with an input integer to choose which query that wants to be fetched. The other prints the query by fetching the cursor in a nested block with exceptions. The following package runs as intended, it prints all the three options without any problems:
    CREATE OR REPLACE PACKAGE admin_data AS
    TYPE gencurtyp IS REF CURSOR;
    PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT);
    procedure print_cv (generic_cv gencurtyp);
    END admin_data;
    CREATE OR REPLACE PACKAGE BODY admin_data AS
    PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT) IS
    BEGIN
    IF choice = 1 THEN
    OPEN generic_cv FOR SELECT * FROM jobs where job_id='ST_MAN';
    ELSIF choice = 2 THEN
    OPEN generic_cv FOR SELECT * FROM departments where department_id=270;
    ELSIF choice = 3 THEN
    OPEN generic_cv FOR SELECT * FROM employees where employee_id=206;
    END IF;
    END;
    procedure print_cv (generic_cv gencurtyp)is
    employees_rec employees%rowtype;
    departments_rec departments%rowtype;
    jobs_rec jobs%rowtype;
    begin
    fetch generic_cv into jobs_rec;
    dbms_output.put_line(jobs_rec.job_title);
    exception
    when ROWTYPE_MISMATCH then
      begin
      fetch generic_cv into departments_rec;
      dbms_output.put_line(departments_rec.department_name);
      exception
      when ROWTYPE_MISMATCH then
        dbms_output.put_line('row mismatch');
        fetch generic_cv into employees_rec;
        dbms_output.put_line(employees_rec.first_name);
      when OTHERS then
        dbms_output.put_line('others');
        fetch generic_cv into employees_rec;
        dbms_output.put_line(employees_rec.first_name);
      end;
    end print_cv;
    END admin_data;
    declare
    some_cur admin_data.gencurtyp;
    begin
    admin_data.open_cv(some_cur,1);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,2);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,3);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,3);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,1);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,2);
    admin_data.print_cv(some_cur);
    end;
    17  /
    Stock Manager
    Payroll
    row mismatch
    William
    row mismatch
    William
    Stock Manager
    Payroll
    PL/SQL procedure successfully completed.The innermost block executes 'rowtype mismatch' exception block, which fetches
    SELECT * FROM employees where employee_id=206 query.
    This time, I switch the query fetch so that
    SELECT * FROM employees where employee_id=206query is in the outermost block and
    SELECT * FROM jobs where job_id='ST_MAN' is in the innermost block. The package body looks like this:
    CREATE OR REPLACE PACKAGE BODY admin_data AS
    PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT) IS
    BEGIN
    IF choice = 1 THEN
    OPEN generic_cv FOR SELECT * FROM jobs where job_id='ST_MAN';
    ELSIF choice = 2 THEN
    OPEN generic_cv FOR SELECT * FROM departments where department_id=270;
    ELSIF choice = 3 THEN
    OPEN generic_cv FOR SELECT * FROM employees where employee_id=206;
    END IF;
    END;
    procedure print_cv (generic_cv gencurtyp)is
    employees_rec employees%rowtype;
    departments_rec departments%rowtype;
    jobs_rec jobs%rowtype;
    begin
    fetch generic_cv into employees_rec;
    dbms_output.put_line(employees_rec.first_name);
    exception
    when ROWTYPE_MISMATCH then
      begin
      fetch generic_cv into departments_rec;
      dbms_output.put_line(departments_rec.department_name);
      exception
      when ROWTYPE_MISMATCH then
        dbms_output.put_line('row mismatch');
        fetch generic_cv into jobs_rec;
        dbms_output.put_line(jobs_rec.job_title);
      when OTHERS then
        dbms_output.put_line('others');
        fetch generic_cv into jobs_rec;
        dbms_output.put_line(jobs_rec.job_title);
      end;
    end print_cv;
    END admin_data;
    then I run the same anonymous block, I get:declare
    some_cur admin_data.gencurtyp;
    begin
    admin_data.open_cv(some_cur,1);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,2);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,3);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,3);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,1);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,2);
    admin_data.print_cv(some_cur);
    end;
    17 /
    others
    Payroll
    William
    William
    others
    Payroll
    PL/SQL procedure successfully completed.
    The strangest thing is the innermost block execute OTHERS exception block instead of ROWTYPE MISMATCH and the the record doesn't fetch anything. What happen? How come the result is different when I only switch the query?
    Best regards,
    Val

    Hi Sy,
    thanks for the reply, yes I agree that the code is cumbersome, I'm studying to prepare OCP PL/SQL certification, so I'm playing around with cursor variable in order to grasp the whole concept. I'm observing the behaviour of weak cursor variable when getting passed into a function and fetched couple of times and exploring exception propagation in the same time. This why the code looks not relevant in the real world.
    Anyway, I just curious how it behaves like that. Here's my instance info:
    SQL> select * from v$version
      2  ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

  • Implementing a nested block diagram

    Hi,
    I would like to draw a block diagram ( as shown in the below image )
    The text on the blocks would be fetched from a well structured XML file.
    If there is a node of type: A in the XML, corresponding green box, say A1 should be drawn and the a horizontal line should be added to connect the end blue box (Gp4)
    Similarly, if there is a node of type: B in the XML, corresponding orange box, say B1 should be drawn and a vertical line should be added to connect the bottom (O/p B) box and the top box (Gp B)
    Similarly, if there is a node of type: C in the XML, corresponding yellow box, say C1 should be drawn and a vertical line should be added to connect the bottom (O/p C) box
    What is the best & easier way to implement this diagram ( HTML, Flash, Flex ) ?
    -  Sen.

    Did you ever figure this one out? I have been tasked to develop something to look like a block diagram as well.  Do you have any tips or recommend any components?  Thanks

  • PL/SQL block nesting.

    I have a script that I can't get working, I have removed most of the working code so that it is easier to look at. The script:
    create or replace
    PROCEDURE DELETE_STUFF
    PHYSICAL_ITEM_ID_IN IN VARCHAR2
    ) AS
    BEGIN
    create or replace type id_table as table of varchar2(30);
    declare
    -- declare nested table to store ids to delete
    items_to_delete id_table default id_table();
    begin
    -- I took out the extra stuff here.
    end;
    END DELETE_STUFF;
    Gives me the error:
    Error starting at line 20 in command:
    END DELETE_STUFF;
    I thought that nesting blocks was acceptable and I'm not sure what I'm doing wrong here. The main reason I have nested it is because I am not sure how to combine the type creation and declaration of those two tables into the procedure declaration. If it is possible to combine them then that would also be an acceptable solution. Also if you put the type creation outside of the procedure than will it persist until somebody deletes it?
    Thanks,
    Ian

    Please change your code as follows.
    HTH
    Ghulam
    create or replace
    PROCEDURE xxcwb.p1
    PHYSICAL_ITEM_ID_IN IN VARCHAR2
    ) AS
      type id_table as table of varchar2(30);
    BEGIN
       declare
       -- declare nested table to store ids to delete
         items_to_delete id_table default id_table();
       begin
          -- I took out the extra stuff here.
          null;
       end;
    END DELETE_STUFF;
    /

  • Nested Selection Screen Blocks

    Hi friends,
    My requirement is to display the two nested blocks in the selection screen and the radio button parameters defined should come in a single group.
    as below........
    !   Begin Block1      
    !        * Radio  Button 1!
    !  Begin  Block2                                        
    !          * Radio  Button 2                                                      ! 
    !          * Radio  Button 3                                                      !
    !         * Radio  Button 4                                                       !
    !   End Block2                                                                     !
    !       End Block 1                                                                 !
             My Requirement is all Radio Buttons 1 2 3 & 4 should be under one group only. I just need nested frames as shown above
    Thanks & Regards,
    Kumar.

    Hi,
    In one group you can not declare only one radio button, you need atleast two radio button for a group.
    if there is a single radio button only, then better you make it as check box.
    Nesting of blocks is possible.
    you can do that.
    In one block there should be atleast two radio button for using Group.
    regards,
    Ruchika
    Reward if useful................

  • Nesting of Objects?

    In structured programming languages, the code can be broken down into blocks.
    The If-Then-Else statement is a block of code, and within it has nested the Test, the Then, and the Else parts of the code.
    The Then and the Else parts are nested blocks which can contain more blocks of code. Objects within Objects.
    Question ? Can objects be nested in this way, or an object constructed to work in this fashion?
    Thank you Shadow Cat, meow

    A java statement or block, which can contain many statements, does not have an intrinsic value like what you would expect with a purely functional programming language. Furthermore, java statements or blocks are not considered objects. You have to keep in mind that java syntax is derived on the heavily imperative C++ language. In your if-then-else example, the (test) portion does not contain an object at all, it must contain a boolean value, or statement that evaluates to a boolean. The (test) portion cannot contain a block of code because, as I mentioned before, code blocks do not evaluate to a value. The (then) and (else) blocks do not contain an object either, just a statement or block. This block is evaluated solely for it's side-effects. The exception to this rule is the (test) ? (then) : (else) syntax which returns a single value based on the expression in the result block.
    Objects can be nested in the data-structure sense of the word. You can pass objects as parameters, get them as return values, and include them in complex data structures.
    -Ryan

  • Applying filters to a nested sequence

    Hey guys.
    This is probably simple, but anyhow, here goes. I'm on a powermac g5 with Final Cut HD.
    I've layered video material and then nested it to create a single video layer which is easier to handle. I then want to apply further filters to the nested material as a whole.
    How do I do this? I select the nested block in the timeline, click on the chosen filter, but no tab appears in the viewer that will allow me to manipulate the filter settings and so on for the nest as a whole.
    If I double click on the nested sequence in the timeline, I get returned to the nested sequence in a new timeline, with all the layers visible. Again it doesn't pop up in the viewer. Surely this can't mean that I have to apply the filter to each layer individually!?
    I'd appreciate any help!
    Best,
    Richard

    opt double click <smacks head on desk repeatedly> - I have to remember that, I always forget it ...

  • WEBSITE PAGE NOT SHOWING UP IN IE9..ONLY THE BACKGROUND SHOWS UP..

    IN FIREFOX AND IE9, I'VE BEEN CREATING THIS SITE. HTML5. NOW, HERE I AM ALMOST DONE WITH THE SITE AND WHEN I DO THE MEDIA PAGE..... IT SEEMS TO ONLY SHOW THE BACKGROUND IN IE9..EVEN AFTER I DELETED IT.. THAT SPECIFIC PAGE (videos.html) IS ONLY DISPLAYING THE BACKGROUND. EACH PAGE I DO, I'VE TESTED THEM IN BOTH BROWSWERS..... KEEPING EVERYTHING THE SAME EXCEPT FOR THE CONTENT WITHIN THE ARTICLE....
    Here's the Code initially, I'm sure there are erros obviously so guys just help me and don't be rude, if you will. I appreciate it greatly.
    HERE'S WHAT IT LOOKS LIKE IN FIREFOX:
    HERE'S WHAT IT LOOKS LIKE IN IE9:
    HERE'S THE CODE:
    (IT'S NEAT IN DREAMWEAVER) BUT... I JUST COPIED AND PASTED IT ONTO HERE.
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta content="DahJ" name="author">
    <meta content="DahJ, Derek, Alton Hill, Dahari, financial freedom, Designer DahJ, Mogul DahJ, Dahari Fashions, university, ministries, Salem, Dahj University, chancellor, business, success, successful, North Las Vegas, Derek, , Coach, mentor, Philanthropist, Best-Selling Author, Author, life-coach, life, " name="keywords">
    <meta content="DAHJ videos, photos, and blog: Official Website" name="description">
    <title>Media - DAHJ videos, photos, and blog: Official Website</title>
    <style type="text/css">
    <!--
    body {
        margin: 0;
        padding: 0;
        color: #000;
        background:url(Images/websitebackgroundhomee.jpg) repeat scroll 0 0;
        font-family: David;
        font-size: 15px;
        height:100%;
    /* ~~ Element/tag selectors ~~ */
    ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
        padding: 0;
        margin: 0;
    h2, h4, h5, h6, p {
        margin-top: 0;
        padding-left: 15px; /* adding the padding to the sides of the elements within the blocks, instead of the block elements themselves, gets rid of any box model math. A nested block with side padding can also be used as an alternate method. */
        font-family: David;
    a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
        border: none;
    /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    a:link {
        color: #42413C;
        text-decoration: none; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    a:visited {
        text-decoration: underline;
    a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
        text-decoration: none;
    /* ~~ This fixed width container surrounds all other blocks ~~ */
    .container {
        width: 960px;
        margin: 0 auto;
        border-radius: 5px;
        -moz-border-radius: 5px;
        -moz-box-shadow: 0 5px 3px 3px #7d7f7e;
        -webkit-box-shadow: 0 5px 3px 5px #7d7f7e;
        box-shadow: 0 5px 3px 3px #999;
        background-image: url(Images/contentbckgrnds/videocontent.jpg);
    /* ~~ The header is not given a width. It will extend the full width of your layout. ~~ */
    header {
        height: 520px;
        width: 960px;
        background-position: center;
        background-color: #000;
    h1 {
        font-family:Century Gothic;
        padding-left:11px;
        font-weight:lighter;
    h1 a:hover {
        color:#09F;
    /* ~~ These are the columns for the layout. ~~
    1) Padding is only placed on the top and/or bottom of the block elements. The elements within these blocks have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the block itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the block element and place a second block element within it with no width and the padding necessary for your design.
    2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a block set to float right). Many times, padding can be used instead. For blocks where this rule must be broken, you should add a "display:inline" declaration to the block element's rule to tame a bug where some versions of Internet Explorer double the margin.
    3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar blocks could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.
    4) If you prefer your nav on the left instead of the right, simply float these columns the opposite direction (all left instead of all right) and they'll render in reverse order. There's no need to move the blocks around in the HTML source.
    .sidebar1 {
        float: right;
        width: 300px;
        background: #fff;
        padding-bottom: 10px;
    .content {
        padding: 0px 0;
        width: 960px;
        float: right;
        background-color: #FFF;
    /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    .content ul, .content ol {
        padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    /* ~~ The footer ~~ */
    footer {
        padding: 10px 0;
        position: relative;/* this gives IE6 hasLayout to properly clear */
        clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
        background-color: #CCC;
        background-image: url(Images/footer2.jpg);
    /*HTML 5 support - Sets new HTML 5 tags to display:block so browsers know how to render the tags properly. */
    header, section, footer, aside, nav, article, figure {
        display: block;
    aside {
    .homebutton{
        background: no-repeat scroll 0 0 transparent;
        height:65px;
        left:-1.2em;
        position:relative;
        top:-3.4em;
        width:172px;
        z-index:20;
    h3 {
        font:"Palatino Linotype", "Book Antiqua", Palatino, serif;
        font-size:small;
        padding-left:15px;
    /*   THIS IS MY FOOTER'S FONT AND TEXT   */
    address {
        font-style:Century Gothic;
        color:#FFFFFF;
        text-decoration:none;
        text-align:center;
        font-style:normal;
    address a:link {
        color:#0CF;
    address a:link, a:hover {
        color:#33CC33;
    /*   THIS IS MY SOCIAL MEDIA LINKS, TITLES, AND COUNTS..... FACEBOOK, TWITTER, YOUTUBE   */
    #socialmedia {
        list-style:none outside  none;
        display:block;
        margin:15px 145px 0px;
        position:relative;
    .twitter {
        display:inline;
        margin-left:135px;
    .facebook {
        display:inline;
    .youtube {
        display:inline;
        margin-left:135px;
    #socialmediatitles {
        list-style:none outside none;
        display:block;
        margin:15px 190px 5px;
        position:relative;
        font-family:Century Gothic;
        font-size:22px;
        color:#ffffff;
        width:800px;
    .twitterfollowers {
        display:inline;
        margin-left:160px;
        color:#ffffff;
    .twitterfollowers a:link {
        color:#ffffff;
    .facebookfans a:link {
        color:#ffffff;
    .youtubesubs a:link {
        color:#ffffff;
    .facebookfans {
        color:#ffffff;
        display:inline;
    .youtubesubs {
        display:inline;
        margin-left:135px;
        color:#ffffff;
    #socialmedianumbers {
        list-style:none outside none;
        display:block;
        margin:15px 185px 5px;
        position:relative;
        font-family:Century Gothic;
        font-size:30px;
        color:#ffffff;
        width:800px;
    .twittercount {
        display:inline;
        margin-left:150px;
        color:#ffffff;
    .twittercount a:link {
        color:#ffffff;
    .facebookcount a:link {
        color:#ffffff;
    .youtubecount a:link {
        color:#ffffff;
    .facebookcount {
        color:#ffffff;
        display:inline;
    .youtubecount {
        display:inline;
        margin-left:135px;
        color:#ffffff;
    div#voverlay {
        background:#FFF;
        display:none;
        height:480px;
        padding:35px;
        width:640px;
    div#voverlay .close {{
        cursor:pointer;
        height:35px;
        position:absolute;
        right:5px;
        top:5px;
        width:35px;
        background:#999;
    div#vcontainer {
        background: url("loading.gif") no-repeat scroll 50% 50% transparent;
        height:100%;
        left:0;
        top:0;
        width:100%;
    .videogallery {
        width:871px;
    .videogallery a {
        color:#333333;
        display:inline-block;
        font:12px/18px "Centurty Gothic";
        margin:3px;
        opacity:0.87;
        position:relative;
        text-align:center;
        text-decoration:none;
        veritcal-align: top;
        width:240px;
    .videogallery a img {
        border:medium none;
        display:block;
        margin:0;
    .videogallery span {
        display:block;
    .videogallery a.videolb {
        display:none;
    </style>
    <style media="screen,print,projection" type="text/css">
    #mediaxmedia{ height:823px; border:none;}
    </style>
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js">
    </script>
    <![endif]-->
    <link href="CSS/dropDown3.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="CSS/videolightbox.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="media_videolb/overlay-minimal.css"/>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/swfobject.js" type="text/javascript"></script>
    </head>
    <body>
    <div class="container">
      <header></header>
      <!----START OF NAVIGATION MENU---->
    <div id="navMenu">
                        <ul>
                          <li></li>
                        </ul> <!-- end inner UL -->
                        <ul>
                          <li><a href="http://www.dahj.com/recent-activity">ACTIVITY</a></li>
                        </ul> <!-- end inner UL -->
                        <ul>
                          <li><a href="http://www.dahj.com/latest-news">NEWS</a></li>
                        </ul> <!-- end inner UL -->
                        <ul>
                          <li><a href="http://www.dahj.com/photogallery">MEDIA</a>
        </ul> <!-- end inner UL -->
                        <ul>
                          <li><a href="http://www.dahj.com/coaching">COACHING</a></li>
                        </ul> <!-- end main UL -->
                        <ul>
                          <li><a href="http://www.dahj.com/shop">SHOP</a></li>
                        </ul> <!-- end inner UL -->
                        <ul>
                          <li><a href="http://www.dahj.com/about">ABOUT</a></li>
                        </ul> <!-- end inner UL -->
                        <p><br class="ClearFloat" />
                        </p>
      </div>
      <!-- end navMenu -->
    <!--------START OF DAHJ HOME ICON------->
              <div class="homebutton">
                <a href="http://www.dahj.com"><img src="Images/websiteicons/bg_logo_new_0.png" width="172" height="61"></a>
            </div>
    <!-- END OF DAHJ HOME ICON BUTTON ------>
    <article class="content">
    <br>
    <!--------VIDEO CONTENT BEGINS HERE--------->
    <div id="voverlay">
        <a class="close"></a>
            <div id="vcontainer"></div>
    </div>
    <center>
    <!-- Start VideoLightBox.com BODY section -->
        <div class="videogallery">
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=39862994&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="Hearing His Voice"><img src="Images/video thumbs/0.png" alt="Hearing His Voice" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=39862218&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="The Trust Fund from ManPower 2010"><img src="Images/video thumbs/1.png" alt="The Trust Fund from ManPower 2010" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=39861243&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="What He Put In You Then Will Work For You Now"><img src="Images/video thumbs/2.png" alt="What He Put In You Then Will Work For You Now" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=39031081&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="The Word 101 - Back to the Basics"><img src="Images/video thumbs/3.png" alt="The Word 101 - Back to the Basics" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=36932142&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="Tough Love - Pastor Sheryl Brady"><img src="Images/video thumbs/4.png" alt="Tough Love - Pastor Sheryl Brady" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=35261687&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="Just Calm Down - Pastor Sheryl Brady"><img src="Images/video thumbs/5.png" alt="Just Calm Down - Pastor Sheryl Brady" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=28674599&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="How to Seduce Proof Your Life"><img src="Images/video thumbs/6.png" alt="How to Seduce Proof Your Life" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=36249630&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="iHeart TPHND - Part 1"><img src="Images/video thumbs/7.png" alt="iHeart TPHND - Part 1" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=36666455&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="iHeart The Potter's House North Dallas - Part 2"><img src="Images/video thumbs/8.png" alt="iHeart The Potter's House North Dallas - Part 2" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=37080493&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="iHeart The Potter's House North Dallas - Part 3"><img src="Images/video thumbs/9.png" alt="iHeart The Potter's House North Dallas - Part 3" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=37535503&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="iHeart TPHND - Part 4"><img src="Images/video thumbs/10.png" alt="iHeart TPHND - Part 4" /><span></span></a>
            <a class="voverlay" href="http://vimeo.com/moogaloop.swf?clip_id=22007961&server=vimeo.com&show_title=1&show_byline= 1&autoplay=1" title="My grandson Jaden playing the drums"><img src="Images/video thumbs/11.png" alt="My grandson Jaden playing the drums" /><span></span></a>
    </div>
    <script src="js/jquery.tools.min.js" type="text/javascript"></script>
    <script src="js/videolightbox.js" type="text/javascript"></script>
    <!-- End VideoLightBox.com BODY section -->
    </center>
    <br>
    </article>
    <!----------------VIDEO CONTENT ENDS HERE------------------>
        <!-----------------NUMBERS BOTTOM ------------>
       <!-----------------END NUMBERS BOTTOM---------->
      <!-- end .content -->
      <footer>
      <br>
      <br>
      <!-----------START SOCIAL MEDIA ICONS---------->
    <div id="socialmedia">
        <div class="facebook">
            <a href="http://facebook.com/dahj"><img src="Images/websiteicons/icontexto-inside-facebook.png"></a>
        </div>
        <div class="twitter">
            <a href="http://twitter.com/officialdahj"><img src="Images/websiteicons/icontexto-inside-twitter.png"></a>
        </div>
        <div class="youtube">
            <a href="http://youtube.com/dahj"><img src="Images/websiteicons/icontexto-inside-youtube.png"></a>
        </div>
    </div>
    <!-------------END SOCIAL MEDIA ICONS------>
    <!-------------START OF SOCIAL MEDIA TITLES------------>
    <div id="socialmediatitles">
        <div class="facebookfans">
            <a href="http://facebook.com/dahj">FANS</a>
        </div>
        <div class="twitterfollowers">
            <a href="http://twitter.com/officialdahj">FOLLOWERS</a>
        </div>
        <div class="youtubesubs">
            <a href="http://youtube.com/dahj">SUBSCRIBERS</a>
        </div>
    </div>
    <!------------END OF SOCIAL MEDIA TITLES---------------->
        <address>
        <br>
        <br>
        ©2012 Copyright | <a href="http://dahj.com/privacy-policy">Privacy Policy/Your Privacy Rights</a> | <a href="http://dahj.com/terms-of-use">Terms of Use</a> | <a href="http://dahj.com/contact-information">Contact US</a> | <a href="http://dahj.com/feedback">Feedback</a>
        </address>
    </footer>
    <!-- end .container -->
    </div>
    </body>
    </html>

    I am not sure what's happening with IE9 (no live site) but I had real problems viewing your code in Live View - until I removed the HTML comment marked below. Basically your site was viewable in Design View but as soon a I hit Live view, it disappeared - much like IE9. See if removing the comment solves your issue.
    <style type="text/css">
    <!-- /*Remove this */
    body {
        margin: 0;
        padding: 0;
        color: #000;
        background:url(Images/websitebackgroundhomee.jpg) repeat scroll 0 0;
        font-family: David;
        font-size: 15px;
        height:100%;

  • PL/SQL 101 : Exception Handling

    Frequently I see questions and issues around the use of Exception/Error Handling in PL/SQL.  More often than not the issue comes from the questioners misunderstanding about how PL/SQL is constructed and executed, so I thought I'd write a small article covering the key concepts to give a clear picture of how it all hangs together. (Note: the examples are just showing examples of the exception handling structure, and should not be taken as truly valid code for ways of handling things)
    Exception Handling
    Contents
    1. Understanding Execution Blocks (part 1)
    2. Execution of the Execution Block
    3. Exceptions
    4. Understanding Execution Blocks (part 2)
    5. How to continue exection of statements after an exception
    6. User defined exceptions
    7. Line number of exception
    8. Exceptions within code within the exception block
    1. Understanding Execution Blocks (part 1)
    The first thing that one needs to understand is almost taking us back to the basics of PL/SQL... how a PL/SQL execution block is constructed.
    Essentially an execution block is made of 3 sections...
    +---------------------------+
    |    Declaration Section    |
    +---------------------------+
    |    Statements  Section    |
    +---------------------------+
    |     Exception Section     |
    +---------------------------+
    The Declaration section is the part defined between the PROCEDURE/FUNCTION header or the DECLARE keyword (for anonymous blocks) and the BEGIN keyword.  (Optional section)
    The Statements section is where your code goes and lies between the BEGIN keyword and the EXCEPTION keyword (or END keyword if there is no EXCEPTION section).  (Mandatory section)
    The Exception section is where any exception handling goes and lies between the EXCEPTION keyword at the END keyword. (Optional section)
    Example of an anonymous block...
    DECLARE
      .. declarative statements go here ..
    BEGIN
      .. code statements go here ..
    EXCEPTION
      .. exception handlers go here ..
    END;
    Example of a procedure/function block...
    [CREATE OR REPLACE] (PROCEDURE|FUNCTION) <proc or fn name> [(<parameters>)] [RETURN <datatype>] (IS|AS)
      .. declarative statements go here ..
    BEGIN
      .. code statements go here ..
    EXCEPTION
      .. exception handlers go here ..
    END;
    (Note: The same can also be done for packages, but let's keep it simple)
    2. Execution of the Execution Block
    This may seem a simple concept, but it's surprising how many people have issues showing they haven't grasped it.  When an Execution block is entered, the declaration section is processed, creating a scope of variables, types , cursors, etc. to be visible to the execution block and then execution enters into the Statements section.  Each statment in the statements section is executed in turn and when the execution completes the last statment the execution block is exited back to whatever called it.
    3. Exceptions
    Exceptions generally happen during the execution of statements in the Statements section.  When an exception happens the execution of statements jumps immediately into the exception section.  In this section we can specify what exceptions we wish to 'capture' or 'trap' and do one of the two following things...
    (Note: The exception section still has access to all the declared items in the declaration section)
    3.i) Handle the exception
    We do this when we recognise what the exception is (most likely it's something we expect to happen) and we have a means of dealing with it so that our application can continue on.
    Example...
    (without the exception handler the exception is passed back to the calling code, in this case SQL*Plus)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3  begin
      4    select ename
      5    into   v_name
      6    from   emp
      7    where  empno = &empno;
      8    dbms_output.put_line(v_name);
      9* end;
    SQL> /
    Enter value for empno: 123
    old   7:   where  empno = &empno;
    new   7:   where  empno = 123;
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 4
    (with an exception handler, we capture the exception, handle it how we want to, and the calling code is happy that there is no error for it to report)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3  begin
      4    select ename
      5    into   v_name
      6    from   emp
      7    where  empno = &empno;
      8    dbms_output.put_line(v_name);
      9  exception
    10    when no_data_found then
    11      dbms_output.put_line('There is no employee with this employee number.');
    12* end;
    SQL> /
    Enter value for empno: 123
    old   7:   where  empno = &empno;
    new   7:   where  empno = 123;
    There is no employee with this employee number.
    PL/SQL procedure successfully completed.
    3.ii) Raise the exception
    We do this when:-
    a) we recognise the exception, handle it but still want to let the calling code know that it happened
    b) we recognise the exception, wish to log it happened and then let the calling code deal with it
    c) we don't recognise the exception and we want the calling code to deal with it
    Example of b)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3    v_empno NUMBER := &empno;
      4  begin
      5    select ename
      6    into   v_name
      7    from   emp
      8    where  empno = v_empno;
      9    dbms_output.put_line(v_name);
    10  EXCEPTION
    11    WHEN no_data_found THEN
    12      INSERT INTO sql_errors (txt)
    13      VALUES ('Search for '||v_empno||' failed.');
    14      COMMIT;
    15      RAISE;
    16* end;
    SQL> /
    Enter value for empno: 123
    old   3:   v_empno NUMBER := &empno;
    new   3:   v_empno NUMBER := 123;
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 15
    SQL> select * from sql_errors;
    TXT
    Search for 123 failed.
    SQL>
    Example of c)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3    v_empno NUMBER := &empno;
      4  begin
      5    select ename
      6    into   v_name
      7    from   emp
      8    where  empno = v_empno;
      9    dbms_output.put_line(v_name);
    10  EXCEPTION
    11    WHEN no_data_found THEN
    12      INSERT INTO sql_errors (txt)
    13      VALUES ('Search for '||v_empno||' failed.');
    14      COMMIT;
    15      RAISE;
    16    WHEN others THEN
    17      RAISE;
    18* end;
    SQL> /
    Enter value for empno: 'ABC'
    old   3:   v_empno NUMBER := &empno;
    new   3:   v_empno NUMBER := 'ABC';
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 3
    SQL> select * from sql_errors;
    TXT
    Search for 123 failed.
    SQL>
    As you can see from the sql_errors log table, no log was written so the WHEN others exception was the exception that raised the error to the calling code (SQL*Plus)
    4. Understanding Execution Blocks (part 2)
    Ok, so now we understand the very basics of an execution block and what happens when an exception happens.  Let's take it a step further...
    Execution blocks are not just a single simple block in most cases.  Often, during our statements section we have a need to call some reusable code and we do that by calling a procedure or function.  Effectively this nests the procedure or function's code as another execution block within the current statement section so, in terms of execution, we end up with something like...
    +---------------------------------+
    |    Declaration Section          |
    +---------------------------------+
    |    Statements  Section          |
    |            .                    |
    |  +---------------------------+  |
    |  |    Declaration Section    |  |
    |  +---------------------------+  |
    |  |    Statements  Section    |  |
    |  +---------------------------+  |
    |  |     Exception Section     |  |
    |  +---------------------------+  |
    |            .                    |
    +---------------------------------+
    |     Exception Section           |
    +---------------------------------+
    Example... (Note: log_trace just writes some text to a table for tracing)
    SQL> create or replace procedure a as
      2    v_dummy NUMBER := log_trace('Procedure A''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure A''s Statement Section');
      5    v_dummy := 1/0; -- cause an exception
      6  exception
      7    when others then
      8      v_dummy := log_trace('Procedure A''s Exception Section');
      9      raise;
    10  end;
    11  /
    Procedure created.
    SQL> create or replace procedure b as
      2    v_dummy NUMBER := log_trace('Procedure B''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure B''s Statement Section');
      5    a; -- HERE the execution passes to the declare/statement/exception sections of A
      6  exception
      7    when others then
      8      v_dummy := log_trace('Procedure B''s Exception Section');
      9      raise;
    10  end;
    11  /
    Procedure created.
    SQL> exec b;
    BEGIN b; END;
    ERROR at line 1:
    ORA-01476: divisor is equal to zero
    ORA-06512: at "SCOTT.B", line 9
    ORA-06512: at line 1
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Procedure A's Declaration Section
    Procedure A's Statement Section
    Procedure A's Exception Section
    Procedure B's Exception Section
    6 rows selected.
    SQL>
    Likewise, execution blocks can be nested deeper and deeper.
    5. How to continue exection of statements after an exception
    One of the common questions asked is how to return execution to the statement after the one that created the exception and continue on.
    Well, firstly, you can only do this for statements you expect to raise an exception, such as when you want to check if there is no data found in a query.
    If you consider what's been shown above you could put any statement you expect to cause an exception inside it's own procedure or function with it's own exception section to handle the exception without raising it back to the calling code.  However, the nature of procedures and functions is really to provide a means of re-using code, so if it's a statement you only use once it seems a little silly to go creating individual procedures for these.
    Instead, you nest execution blocks directly, to give the same result as shown in the diagram at the start of part 4 of this article.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure b (p_empno IN VARCHAR2) as
      2    v_dummy NUMBER := log_trace('Procedure B''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure B''s Statement Section');
      5    -- Here we start another execution block nested in the first one...
      6    declare
      7      v_dummy NUMBER := log_trace('Nested Block Declaration Section');
      8    begin
      9      v_dummy := log_trace('Nested Block Statement Section');
    10      select empno
    11        into   v_dummy
    12        from   emp
    13       where  empno = p_empno; -- Note: the parameters and variables from
                                         parent execution block are available to use!
    14    exception
    15      when no_data_found then
    16        -- This is an exception we can handle so we don't raise it
    17        v_dummy := log_trace('No employee was found');
    18        v_dummy := log_trace('Nested Block Exception Section - Exception Handled');
    19      when others then
    20        -- Other exceptions we can't handle so we raise them
    21        v_dummy := log_trace('Nested Block Exception Section - Exception Raised');
    22        raise;
    23    end;
    24    -- ...Here endeth the nested execution block
    25    -- As the nested block handled it's exception we come back to here...
    26    v_dummy := log_trace('Procedure B''s Statement Section Continued');
    27  exception
    28    when others then
    29      -- We'll only get to here if an unhandled exception was raised
    30      -- either in the nested block or in procedure b's statement section
    31      v_dummy := log_trace('Procedure B''s Exception Section');
    32      raise;
    33* end;
    SQL> /
    Procedure created.
    SQL> exec b(123);
    PL/SQL procedure successfully completed.
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Nested Block Declaration Section
    Nested Block Statement Section
    No employee was found
    Nested Block Exception Section - Exception Handled
    Procedure B's Statement Section Continued
    7 rows selected.
    SQL> truncate table code_trace;
    Table truncated.
    SQL> exec b('ABC');
    BEGIN b('ABC'); END;
    ERROR at line 1:
    ORA-01722: invalid number
    ORA-06512: at "SCOTT.B", line 32
    ORA-06512: at line 1
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Nested Block Declaration Section
    Nested Block Statement Section
    Nested Block Exception Section - Exception Raised
    Procedure B's Exception Section
    6 rows selected.
    SQL>
    You can see from this that, very simply, the code that we expected may have an exception was able to either handle the exception and return to the outer execution block to continue execution, or if an unexpected exception occurred then it was able to be raised up to the outer exception section.
    6. User defined exceptions
    There are three sorts of 'User Defined' exceptions.  There are logical situations (e.g. business logic) where, for example, certain criteria are not met to complete a task, and there are existing Oracle errors that you wish to give a name to in order to capture them in the exception section.  The third is raising your own exception messages with our own exception numbers.  Let's look at the first one...
    Let's say I have tables which detail stock availablility and reorder levels...
    SQL> select * from reorder_level;
       ITEM_ID STOCK_LEVEL
             1          20
             2          20
             3          10
             4           2
             5           2
    SQL> select * from stock;
       ITEM_ID ITEM_DESC  STOCK_LEVEL
             1 Pencils             10
             2 Pens                 2
             3 Notepads            25
             4 Stapler              5
             5 Hole Punch           3
    SQL>
    Now, our Business has told the administrative clerk to check stock levels and re-order anything that is below the re-order level, but not to hold stock of more than 4 times the re-order level for any particular item.  As an IT department we've been asked to put together an application that will automatically produce the re-order documents upon the clerks request and, because our company is so tight-ar*ed about money, they don't want to waste any paper with incorrect printouts so we have to ensure the clerk can't order things they shouldn't.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6      from stock s join reorder_level r on (s.item_id = r.item_id)
      7      where s.item_id = p_item_id;
      8    --
      9    v_stock cur_stock_reorder%ROWTYPE;
    10  begin
    11    OPEN cur_stock_reorder;
    12    FETCH cur_stock_reorder INTO v_stock;
    13    IF cur_stock_reorder%NOTFOUND THEN
    14      RAISE no_data_found;
    15    END IF;
    16    CLOSE cur_stock_reorder;
    17    --
    18    IF v_stock.stock_level >= v_stock.reorder_level THEN
    19      -- Stock is not low enough to warrant an order
    20      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    21    ELSE
    22      IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    23        -- Required amount is over-ordering
    24        DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                     ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    25      ELSE
    26        DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    27        -- Here goes our code to print the order
    28      END IF;
    29    END IF;
    30    --
    31  exception
    32    WHEN no_data_found THEN
    33      CLOSE cur_stock_reorder;
    34      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    35* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(10,100);
    Invalid Item ID.
    PL/SQL procedure successfully completed.
    SQL> exec re_order(3,40);
    Stock has not reached re-order level yet!
    PL/SQL procedure successfully completed.
    SQL> exec re_order(1,100);
    Quantity specified is too much.  Max for this item: 70
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,50);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL>
    Ok, so that code works, but it's a bit messy with all those nested IF statements. Is there a cleaner way perhaps?  Wouldn't it be nice if we could set up our own exceptions...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6      from stock s join reorder_level r on (s.item_id = r.item_id)
      7      where s.item_id = p_item_id;
      8    --
      9    v_stock cur_stock_reorder%ROWTYPE;
    10    --
    11    -- Let's declare our own exceptions for business logic...
    12    exc_not_warranted EXCEPTION;
    13    exc_too_much      EXCEPTION;
    14  begin
    15    OPEN cur_stock_reorder;
    16    FETCH cur_stock_reorder INTO v_stock;
    17    IF cur_stock_reorder%NOTFOUND THEN
    18      RAISE no_data_found;
    19    END IF;
    20    CLOSE cur_stock_reorder;
    21    --
    22    IF v_stock.stock_level >= v_stock.reorder_level THEN
    23      -- Stock is not low enough to warrant an order
    24      RAISE exc_not_warranted;
    25    END IF;
    26    --
    27    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    28      -- Required amount is over-ordering
    29      RAISE exc_too_much;
    30    END IF;
    31    --
    32    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    33    -- Here goes our code to print the order
    34    --
    35  exception
    36    WHEN no_data_found THEN
    37      CLOSE cur_stock_reorder;
    38      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    39    WHEN exc_not_warranted THEN
    40      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    41    WHEN exc_too_much THEN
    42      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    43* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(10,100);
    Invalid Item ID.
    PL/SQL procedure successfully completed.
    SQL> exec re_order(3,40);
    Stock has not reached re-order level yet!
    PL/SQL procedure successfully completed.
    SQL> exec re_order(1,100);
    Quantity specified is too much.  Max for this item: 70
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,50);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL>
    That's better.  And now we don't have to use all those nested IF statements and worry about it accidently getting to code that will print the order out as, once one of our user defined exceptions is raised, execution goes from the Statements section into the Exception section and all handling of errors is done in one place.
    Now for the second sort of user defined exception...
    A new requirement has come in from the Finance department who want to have details shown on the order that show a re-order 'indicator' based on the formula ((maximum allowed stock - current stock)/re-order quantity), so this needs calculating and passing to the report...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    -- Let's declare our own exceptions for business logic...
    13    exc_not_warranted EXCEPTION;
    14    exc_too_much      EXCEPTION;
    15  begin
    16    OPEN cur_stock_reorder;
    17    FETCH cur_stock_reorder INTO v_stock;
    18    IF cur_stock_reorder%NOTFOUND THEN
    19      RAISE no_data_found;
    20    END IF;
    21    CLOSE cur_stock_reorder;
    22    --
    23    IF v_stock.stock_level >= v_stock.reorder_level THEN
    24      -- Stock is not low enough to warrant an order
    25      RAISE exc_not_warranted;
    26    END IF;
    27    --
    28    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    29      -- Required amount is over-ordering
    30      RAISE exc_too_much;
    31    END IF;
    32    --
    33    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    34    -- Here goes our code to print the order, passing the finance_factor
    35    --
    36  exception
    37    WHEN no_data_found THEN
    38      CLOSE cur_stock_reorder;
    39      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    40    WHEN exc_not_warranted THEN
    41      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    42    WHEN exc_too_much THEN
    43      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    44* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(2,40);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,0);
    BEGIN re_order(2,0); END;
    ERROR at line 1:
    ORA-01476: divisor is equal to zero
    ORA-06512: at "SCOTT.RE_ORDER", line 17
    ORA-06512: at line 1
    SQL>
    Hmm, there's a problem if the person specifies a re-order quantity of zero.  It raises an unhandled exception.
    Well, we could put a condition/check into our code to make sure the parameter is not zero, but again we would be wrapping our code in an IF statement and not dealing with the exception in the exception handler.
    We could do as we did before and just include a simple IF statement to check the value and raise our own user defined exception but, in this instance the error is standard Oracle error (ORA-01476) so we should be able to capture it inside the exception handler anyway... however...
    EXCEPTION
      WHEN ORA-01476 THEN
    ... is not valid.  What we need is to give this Oracle error a name.
    This is done by declaring a user defined exception as we did before and then associating that name with the error number using the PRAGMA EXCEPTION_INIT statement in the declaration section.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    -- Let's declare our own exceptions for business logic...
    13    exc_not_warranted EXCEPTION;
    14    exc_too_much      EXCEPTION;
    15    --
    16    exc_zero_quantity EXCEPTION;
    17    PRAGMA EXCEPTION_INIT(exc_zero_quantity, -1476);
    18  begin
    19    OPEN cur_stock_reorder;
    20    FETCH cur_stock_reorder INTO v_stock;
    21    IF cur_stock_reorder%NOTFOUND THEN
    22      RAISE no_data_found;
    23    END IF;
    24    CLOSE cur_stock_reorder;
    25    --
    26    IF v_stock.stock_level >= v_stock.reorder_level THEN
    27      -- Stock is not low enough to warrant an order
    28      RAISE exc_not_warranted;
    29    END IF;
    30    --
    31    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    32      -- Required amount is over-ordering
    33      RAISE exc_too_much;
    34    END IF;
    35    --
    36    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    37    -- Here goes our code to print the order, passing the finance_factor
    38    --
    39  exception
    40    WHEN exc_zero_quantity THEN
    41      DBMS_OUTPUT.PUT_LINE('Quantity of 0 (zero) is invalid.');
    42    WHEN no_data_found THEN
    43      CLOSE cur_stock_reorder;
    44      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    45    WHEN exc_not_warranted THEN
    46      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    47    WHEN exc_too_much THEN
    48      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    49* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(2,0);
    Quantity of 0 (zero) is invalid.
    PL/SQL procedure successfully completed.
    SQL>
    Lastly, let's look at raising our own exceptions with our own exception numbers...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    exc_zero_quantity EXCEPTION;
    13    PRAGMA EXCEPTION_INIT(exc_zero_quantity, -1476);
    14  begin
    15    OPEN cur_stock_reorder;
    16    FETCH cur_stock_reorder INTO v_stock;
    17    IF cur_stock_reorder%NOTFOUND THEN
    18      RAISE no_data_found;
    19    END IF;
    20    CLOSE cur_stock_reorder;
    21    --
    22    IF v_stock.stock_level >= v_stock.reorder_level THEN
    23      -- Stock is not low enough to warrant an order
    24      [b]RAISE_APPLICATION_ERROR(-20000, 'Stock has not reached re-order level yet!');[/b]
    25    END IF;
    26    --
    27    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    28      -- Required amount is over-ordering
    29     

    its nice article, have put up this one the blog
    site,Nah, I don't have time to blog, but if one of the other Ace's/Experts wants to copy it to a blog with reference back to here (and all due credit given ;)) then that's fine by me.
    I'd go for a book like "Selected articles by OTN members" or something. Does anybody have a list of links of all those mentioned articles?Just these ones I've bookmarked...
    Introduction to regular expressions ... by CD
    When your query takes too long ... by Rob van Wijk
    How to pipeline a function with a dynamic number of columns? by ascheffer
    PL/SQL 101 : Exception Handling by BluShadow

  • Page gap in DW CS6 tutorial. Please help!

    I am getting this gap in my page and it started just after I added this <nav> bar. I have done this lesson several times starting from scratch and it still gives me this gap. I am not sure if the book is missing something or it's me. The book shows no gap in the examples. I would greatly appreciate any help. I am a little new to DW. I took HTML in high school about 16 years ago so I understand some code by hand. Thanks for your time.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
    font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
    background-color: #FFF;
    margin: 0;
    padding: 0;
    color: #000;
    /* ~~ Element/tag selectors ~~ */
    ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
    padding: 0;
    margin: 0;
    h1, h2, h3, h4, h5, h6, p {
    margin-top: 0;  /* removing the top margin gets around an issue where margins can escape from their containing block. The remaining bottom margin will hold it away from any elements that follow. */
    padding-right: 15px;
    padding-left: 15px; /* adding the padding to the sides of the elements within the blocks, instead of the block elements themselves, gets rid of any box model math. A nested block with side padding can also be used as an alternate method. */
    a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
    border: none;
    /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    a:link {
    color: #42413C;
    text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    a:visited {
    color: #6E6C64;
    text-decoration: underline;
    a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
    text-decoration: none;
    /* ~~ This fixed width container surrounds all other blocks ~~ */
    .container {
    width: 950px;
    background-color: #FFFFFF;
    margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
    border: 2px solid #060;
    /* ~~ The header is not given a width. It will extend the full width of your layout. ~~ */
    header {
    background-color: #090;
    background-image: url(Lessons/images/banner.jpg);
    background-repeat: no-repeat;
    height: 130px;
    /* ~~ These are the columns for the layout. ~~
    1) Padding is only placed on the top and/or bottom of the block elements. The elements within these blocks have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the block itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the block element and place a second block element within it with no width and the padding necessary for your design.
    2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a block set to float right). Many times, padding can be used instead. For blocks where this rule must be broken, you should add a "display:inline" declaration to the block element's rule to tame a bug where some versions of Internet Explorer double the margin.
    3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar blocks could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.
    4) If you prefer your nav on the left instead of the right, simply float these columns the opposite direction (all left instead of all right) and they'll render in reverse order. There's no need to move the blocks around in the HTML source.
    .sidebar1 {
    float: left;
    width: 180px;
    background-color: #EADCAE;
    padding-bottom: 10px;
    .content {
    padding: 10px 0;
    width: 770px;
    float: right;
    /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    .content ul, .content ol {
    padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
    ul.nav {
    list-style: none; /* this removes the list marker */
    border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
    margin-bottom: 15px; /* this creates the space between the navigation on the content below */
    ul.nav li {
    border-bottom: 1px solid #666; /* this creates the button separation */
    ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
    padding: 5px 5px 5px 15px;
    display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */
    width: 160px;  /*this width makes the entire button clickable for IE6. If you don't need to support IE6, it can be removed. Calculate the proper width by subtracting the padding on this link from the width of your sidebar container. */
    text-decoration: none;
    background-color: #090;
    color: #FFC;
    ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
    background-color: #ADB96E;
    color: #FFF;
    /* ~~ The footer ~~ */
    footer {
    padding: 10px 0;
    background-color: #CCC49F;
    position: relative;/* this gives IE6 hasLayout to properly clear */
    clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
    /*HTML 5 support - Sets new HTML 5 tags to display:block so browsers know how to render the tags properly. */
    header, section, footer, aside, article, figure {
    display: block;
    #apDiv1 {
    position: absolute;
    width: 170px;
    height: 158px;
    z-index: 1;
    margin-top: 10px;
    margin-left: 30px;
    nav p {
    font-size: 90%;
    color: #FFC;
    text-align: right;
    font-weight: bold;
    background-color: #090;
    padding-top: 5px;
    padding-right: 20px;
    padding-bottom: 5px;
    border-top-width: 2px;
    border-top-style: solid;
    border-top-color: #060;
    -->
    </style><!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]--></head>
    <body>
    <div class="container">
      <div id="apDiv1"><img src="Lessons/images/butterfly-ovr.png" width="170" height="158" alt="GreenStart Logo"></div>
      <header></header>
        <div class="sidebar1">
        <ul class="nav">
          <li><a href="#">Green News</a></li>
          <li><a href="#">Green Products</a></li>
          <li><a href="#">Green Events</a></li>
          <li><a href="#">Green Travel</a></li>
          <li><a href="#">Green Tips</a></li>
        </ul>
        <aside>
          <p> The above links demonstrate a basic navigational structure using an unordered list styled with CSS. Use this as a starting point and modify the properties to produce your own unique look. If you require flyout menus, create your own using a Spry menu, a menu widget from Adobe's Exchange or a variety of other javascript or CSS solutions.</p>
          <p>If you would like the navigation along the top, simply move the ul to the top of the page and recreate the styling.</p>
        </aside>
      <!-- end .sidebar1 --></div>
      <article class="content">
        <h1>Instructions</h1>
        <section>
         <h2>How to use this document</h2>
          <p>Be aware that the CSS for these layouts is heavily commented. If you do most of your work in Design view, have a peek at the code to get tips on working with the CSS for the fixed layouts. You can remove these comments before you launch your site. To learn more about the techniques used in these CSS Layouts, read this article at Adobe's Developer Center - <a href="http://www.adobe.com/go/adc_css_layouts.http://www.adobe.com/go/adc_css_layouts">http://www.adobe.com/go/adc_css_layouts</a>.</p>
        </section>
        <section>
          <h2>Clearing Method</h2>
          <p>Because all the columns are floated, this layout uses a clear:both declaration in the footer rule.  This clearing technique forces the .container to understand where the columns end in order to show any borders or background colors you place on the .container. If your design requires you to remove the footer from the .container, you'll need to use a different clearing method. The most reliable will be to add a &lt;br class=&quot;clearfloat&quot; /&gt; or &lt;div  class=&quot;clearfloat&quot;&gt;&lt;/div&gt; after your final floated column (but before the .container closes). This will have the same clearing effect. </p>
        </section>
        <section>
          <h2>Logo Replacement</h2>
          <p>An image placeholder was used in this layout in the header where you'll likely want to place  a logo. It is recommended that you remove the placeholder and replace it with your own linked logo. </p>
          <p> Be aware that if you use the Property inspector to navigate to your logo image using the SRC field (instead of removing and replacing the placeholder), you should remove the inline background and display properties. These inline styles are only used to make the logo placeholder show up in browsers for demonstration purposes. </p>
          <p>To remove the inline styles, make sure your CSS Styles panel is set to Current. Select the image, and in the Properties pane of the CSS Styles panel, right click and delete the display and background properties. (Of course, you can always go directly into the code and delete the inline styles from the image or placeholder there.)</p>
        </section>
        <section>
          <h2>Backgrounds</h2>
          <p>By nature, the background color on any block element will only show for the length of the content. This means if you're using a background color or border to create the look of a side column, it won't extend all the way to the footer but will stop when the content ends. If the .content block will always contain more content, you can place a border on the .content block to divide it from the column.</p>
        </section>
        <!-- end .content --></article>
      <footer>
        <p>This footer contains the declaration position:relative; to give Internet Explorer 6 hasLayout for the footer and cause it to clear correctly. If you're not required to support IE6, you may remove it.</p>
        <address>
          Address Content
        </address>
      </footer>
    <!-- end .container --></div>
    </body>
    </html>

    Sorry about that. I am not exactly sure where the problem is, but I know it takes place after I put the <nav> in (in the html portion). If I understand what I am learning, the CSS at the top will structure my html code so I would have thought the CSS tageting my nav would be the focus. Maybe it is a different section though.
    CSS part:
    nav p {
    font-size: 90%;
    color: #FFC;
    text-align: right;
    font-weight: bold;
    background-color: #090;
    padding-top: 5px;
    padding-right: 20px;
    padding-bottom: 5px;
    border-top-width: 2px;
    border-top-style: solid;
    border-top-color: #060;
    HTML part: (bold italic is the part I added)
    <body>
    <div class="container">
      <div id="apDiv1"><img src="Lessons/images/butterfly-ovr.png" width="170" height="158" alt="GreenStart Logo"></div>
      <header></header>
      <nav>
        <p>Home | About Us | Contact Us</p>
      </nav>
      <div class="sidebar1">
        <ul class="nav">
          <li><a href="#">Green News</a></li>
          <li><a href="#">Green Products</a></li>
          <li><a href="#">Green Events</a></li>
          <li><a href="#">Green Travel</a></li>
          <li><a href="#">Green Tips</a></li>
        </ul>

  • How do I remove whitespace from a template header

    I am trying to work myself thru understanding html coding by using a dreamweaver template and creating a page for my company. I have used dreamweaver before CC, however I am trying to understand the new changes.
    I ran into a problem I am hoping to get help with.
    I tried swapping out a placeholder logo on the template with my own logo. I seem to have a bit of white space at the bottom of the logo when I see it in live view or a browser. How can I get rid of it. I tried combinations of 0 margins and changing padding, but it seems I'm just whistling in the dark. Here is the code:
    The CSS associated with this page is here:
    @charset "UTF-8"; body {   font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;   background-color: #42413C;   margin: 0;   padding: 0;   color: #000; } /* ~~ Element/tag selectors ~~ */ ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */   padding: 0;   margin: 0; } h1, h2, h3, h4, h5, h6, p {   margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing block. The remaining bottom margin will hold it away from any elements that follow. */   padding-right: 15px;   padding-left: 15px; /* adding the padding to the sides of the elements within the blocks, instead of the block elements themselves, gets rid of any box model math. A nested block with side padding can also be used as an alternate method. */ } a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */   border: none; } /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */ a:link {   color: #42413C;   text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */ } a:visited {   color: #6E6C64;   text-decoration: underline; } a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */   text-decoration: none; } /* ~~ This fixed width container surrounds all other blocks ~~ */ .container {   width: 960px;   background-color: #FFFFFF;   margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */ } /* ~~ The header is not given a width. It will extend the full width of your layout. ~~ */ header {   background-color: #A36BE8; } /* ~~ These are the columns for the layout. ~~ 1) Padding is only placed on the top and/or bottom of the block elements. The elements within these blocks have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the block itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the block element and place a second block element within it with no width and the padding necessary for your design. 2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a block set to float right). Many times, padding can be used instead. For blocks where this rule must be broken, you should add a "display:inline" declaration to the block element's rule to tame a bug where some versions of Internet Explorer double the margin. 3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar blocks could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document. 4) If you prefer your nav on the left instead of the right, simply float these columns the opposite direction (all left instead of all right) and they'll render in reverse order. There's no need to move the blocks around in the HTML source. */ .sidebar1 {   float: right;   width: 180px;   background-color: #C5C2B8;   padding-bottom: 10px; } .content {   padding: 10px 0;   width: 780px;   float: right; } /* ~~ This grouped selector gives the lists in the .content area space ~~ */ .content ul, .content ol {   padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */ } /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */ nav ul{   list-style: none; /* this removes the list marker */   border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */   margin-bottom: 15px; /* this creates the space between the navigation on the content below */ } nav li {   border-bottom: 1px solid #666; /* this creates the button separation */ } nav a, nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */   padding: 5px 5px 5px 15px;   display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */   width: 160px;  /*this width makes the entire button clickable for IE6. If you don't need to support IE6, it can be removed. Calculate the proper width by subtracting the padding on this link from the width of your sidebar container. */   text-decoration: none;   background-color: #15EE00; } nav a:hover, nav a:active, nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */   background-color: #ADB96E;   color: #FFF; } /* ~~ The footer ~~ */ footer {   padding: 10px 0;   background-color: #CCC49F;   position: relative;/* this gives IE6 hasLayout to properly clear */   clear: both; /* this clear property forces the .container to understand where the columns end and contain them */ } /*HTML 5 support - Sets new HTML 5 tags to display:block so browsers know how to render the tags properly. */ header, section, footer, aside, article, figure {   display: block; } 
    Thank you for your help!

    Try this -
    <img src="assets/jpgs/Prodigy Logo Large 2014.jpg" width="180" height="180" alt="" style="display:block;">
    What you are seeing as whitespace is the space reserved for glyph descenders on any element that is rendered within a text box (i.e., an inline element). By making the image "display:block" you eliminate that space because a block element doesn't have descenders. If that works to your satisfaction then you can give the logo an id, and create a CSS selector containing that block style.

  • Sidebar not flush with top border

    I am brand new to web design and DW.  I can't figure out how to bring my left sidebar flush with the header of the page.  I am following along in the DW-CS6 Class in a book.  Here is the code.
    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
              background-color: #FFF;
              margin: 0;
              padding: 0;
              color: #000;
              font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
              font-size: 100%;
              line-height: 1.4;
    /* ~~ Element/tag selectors ~~ */
    ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
              padding: 0;
              margin: 0;
    h1, h2, h3, h4, h5, h6, p {
              margin-top: 0;           /* removing the top margin gets around an issue where margins can escape from their containing block. The remaining bottom margin will hold it away from any elements that follow. */
              padding-right: 15px;
              padding-left: 15px; /* adding the padding to the sides of the elements within the blocks, instead of the block elements themselves, gets rid of any box model math. A nested block with side padding can also be used as an alternate method. */
    .sidebar1 aside {
              font-size: 90%;
    a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
              border: none;
    /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    a:link {
              color: #42413C;
              text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    a:visited {
              color: #6E6C64;
              text-decoration: underline;
    a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
              text-decoration: none;
    /* ~~ This fixed width container surrounds all other blocks ~~ */
    .container {
              width: 950px;
              background-color: #FFFFFF;
              margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
              border: 2px solid #060;
    #logo {
              position: absolute;
              width: 170px;
              height: 158px;
              z-index: 1;
              margin-top: 10px;
              margin-left: 30px;
    /* ~~ The header is not given a width. It will extend the full width of your layout. ~~ */
    header {
              background-color: #090;
              background-image: url(images/banner.jpg);
              background-repeat: no-repeat;
              height: 130px;
    /* ~~ These are the columns for the layout. ~~
    1) Padding is only placed on the top and/or bottom of the block elements. The elements within these blocks have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the block itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the block element and place a second block element within it with no width and the padding necessary for your design.
    2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a block set to float right). Many times, padding can be used instead. For blocks where this rule must be broken, you should add a "display:inline" declaration to the block element's rule to tame a bug where some versions of Internet Explorer double the margin.
    3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar blocks could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.
    4) If you prefer your nav on the left instead of the right, simply float these columns the opposite direction (all left instead of all right) and they'll render in reverse order. There's no need to move the blocks around in the HTML source.
    .sidebar1 {
              float: left;
              width: 180px;
              background-color: #EADCAE;
              padding-bottom: 10px;
    .content {
              padding: 10px 0;
              width: 770px;
              float: right;
    .content h1 {
              font-size: 200%;
              margin-top: 10px;
              margin-bottom: 5px;
    /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    .content ul, .content ol {
              padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    nav p {
              font-size: 90%;
              font-weight: bold;
              color: #FFC;
              background-color: #090;
              text-align: right;
              padding-top: 5px;
              padding-right: 20px;
              padding-bottom: 5px;
              border-bottom-width: 2px;
              border-bottom-style: solid;
              border-bottom-color: #060;
              background-image: url(images/background.png);
              background-repeat: repeat-x;
    nav p a:link, nav p a:visited {
              text-decoration: none;
              color: #FFC;
              padding: 5px;
    nav p a:hover, nav p a:active {
              color: #FFF;
              background-color: #060;
    /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
    ul.nav {
              list-style: none; /* this removes the list marker */
              border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
              margin-bottom: 15px; /* this creates the space between the navigation on the content below */
    ul.nav li {
              border-top-width: 1px;
              border-right-width: 1px;
              border-bottom-width: 1px;
              border-left-width: 1px;
              border-top-style: solid;
              border-right-style: solid;
              border-bottom-style: solid;
              border-left-style: solid;
              border-top-color: #0C0;
              border-right-color: #060;
              border-bottom-color: #060;
              border-left-color: #0C0;
    ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
              padding: 5px 5px 5px 15px;
              display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */
              width: 160px;  /*this width makes the entire button clickable for IE6. If you don't need to support IE6, it can be removed. Calculate the proper width by subtracting the padding on this link from the width of your sidebar container. */
              text-decoration: none;
              background-color: #090;
              color: #FFC;
    ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
              background-color: #060;
              color: #FFF;
    /* ~~ The footer ~~ */
    footer {
              padding: 10px 0;
              background-color: #090;
              position: relative;/* this gives IE6 hasLayout to properly clear */
              clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
              font-size: 90%;
              color: #FFC;
              background-image: url(images/background.png);
              background-repeat: repeat-x;
    /*HTML 5 support - Sets new HTML 5 tags to display:block so browsers know how to render the tags properly. */
    header, section, footer, aside, article, figure {
              display: block;
    .green {
              color: #090;
    -->
    </style><!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]--></head>
    <body>
    <div class="container">
      <div class="green" id="logo"><img src="images/butterfly-ovr.png" width="170" height="158" alt="GreenStart Logo"></div>
      <header></header>
      <nav>
        <p><a href="#">Home</a> | <a href="#">About Us</a> | <a href="#">Contact Us</a></p>
      </nav>
      <div class="sidebar1">
        <ul class="nav">
          <li><a href="#">Green News</a></li>
          <li><a href="#">Green Products</a></li>
          <li><a href="#">Green Events</a></li>
          <li><a href="#">Green Travel</a></li>
          <li><a href="#">Green Tips</a></li>
        </ul>
        <aside>
          <img name="Sidebar" src="" width="180" height="150" alt="">
          <p>Insert caption here</p>
        </aside>
      <!-- end .sidebar1 --></div>
      <article class="content">
        <h1>Insert main heading here</h1>
        <section>
         <h2>Insert subheading here</h2>
          <p>Insert content here</p>
        </section>
        <!-- end .content --></article>
      <footer>
        <p>Copyright 2012 Meridien GreenStart.  All rights reserved.</p>
        <address>
          Address Content
        </address>
      </footer>
      <!-- end .container --></div>
    </body>
    </html>
    Any help would be greatly appreciated.

    Add this to the end of your nav p CSS selector at Line 209 of your HTML file, after 'background-repeat...':
    margin-bottom: -2px;
    Your nav p will then look like this:
    nav p {
              font-size: 90%;
              font-weight: bold;
              color: #FFC;
              background-color: #090;
              text-align: right;
              padding-top: 5px;
              padding-right: 20px;
              padding-bottom: 5px;
              border-bottom-width: 2px;
              border-bottom-style: solid;
              border-bottom-color: #060;
              background-image: url(images/background.png);
              background-repeat: repeat-x;
              margin-bottom: -2px;

  • Best Practice for Extracting a Single Value from Oracle Table

    I'm using Oracle Database 11g Release 11.2.0.3.0.
    I'd like to know the best practice for doing something like this in a PL/SQL block:
    DECLARE
        v_student_id    student.student_id%TYPE;
    BEGIN
        SELECT  student_id
        INTO    v_student_id
        FROM    student
        WHERE   last_name = 'Smith'
        AND     ROWNUM = 1;
    END;
    Of course, the problem here is that when there is no hit, the NO_DATA_FOUND exception is raised, which halts execution.  So what if I want to continue in spite of the exception?
    Yes, I could create a nested block with EXCEPTION section, etc., but that seems clunky for what seems to be a very simple task.
    I've also seen this handled like this:
    DECLARE
        v_student_id    student.student_id%TYPE;
        CURSOR c_student_id IS
            SELECT  student_id
            FROM    student
            WHERE   last_name = 'Smith'
            AND     ROWNUM = 1;
    BEGIN
        OPEN c_student_id;
        FETCH c_student_id INTO v_student_id;
        IF c_student_id%NOTFOUND THEN
            DBMS_OUTPUT.PUT_LINE('not found');
        ELSE
            (do stuff)
        END IF;
        CLOSE c_student_id;   
    END;
    But this still seems like killing an ant with a sledge hammer.
    What's the best way?
    Thanks for any help you can give.
    Wayne

    Do not design in order to avoid exceptions. Do not code in order to avoid exceptions.
    Exceptions are good. Damn good. As it allows you to catch an unexpected process branch, where execution did not go as planned and coded.
    Trying to avoid exceptions is just plain bloody stupid.
    As for you specific problem. When the SQL fails to find a row and a value to return, what then? This is unexpected - if you did not want a value, you would not have coded the SQL to find a value. So the SQL not finding a value is an exception to what you intend with your code. And you need to decide what to do with that exception.
    How to implement it. The #1 rule in software engineering - modularisation.
    E.g.
    create or replace function FindSomething( name varchar2 ) return foo.col1%type is
      id foo.col1%type;
    begin
      select col1 into id from foo where col2 = upper(name);
      return( id );
    exception when NOT_FOUND then
      return( null );
    end;
    And that is your problem. Modularisation. You are not considering it.
    And not the only problem mind you. Seems like your keyboard has a stuck capslock key. Writing code in all uppercase is just as bloody silly as trying to avoid exceptions.

  • Suppressing ORA-1403 in Forms 6i

    We are running FORMS 6i and I am creating a library function that will do various types of lookups and then behave in specific ways based on passed parameters.
    How can I over-ride the default ORA-1403 when no records are found in the query?
    Thanks

    Use nested begin-exception-end blocks within the pl/sql code in your pll libraryFunction PLL_Lookup(params in varchar2)
      Return varchar2 is
      variables here;
      Result  varchar2(100);
    Begin
      -- for each select you want, create a nested block:
      Begin
        select....
        Exception when no_data_found then.... ;
      End;
      -- more pl/sql here
      -- Maybe another Begin - Exception - End here...
      Return result;
    End;

  • Foramtting Paragraph in Header

    Hi Folks,
                  Forgive my ignorance I'm only new to Dreamweaver, but I'm having an issue with an html5 template included with DW, the two column. I try to put in a paragraph under the header, between vert menu and image in head, but when I go through the property inspector and select paragraph from the drop down it moves the vert menu down and creates a blank space, sort of like a two line paragraph, I don't want this blank space, any ideas? I'm working through one of those classroom in a book training guides and the egs in that don't have the gap either.
    Cheers for you help.

    Hi,
         Oh yeh sorry, i have attached the code as well as a screenshot of the issue in Dreamweaver, as you can see there is a gap between the green header section and the "instructions"/ "link one," this gap only occurred after I attempted to insert a paragraph under format drop down menu in Property Inspector. Note also that I'm modifying the html5 2 column template included with Dreamweaver under html.
    I hope this helps.
    Thanks again.
    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
              font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
              background-color: #42413C;
              margin: 0;
              padding: 0;
              color: #000;
    /* ~~ Element/tag selectors ~~ */
    ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
              padding: 0;
              margin: 0;
    h1, h2, h3, h4, h5, h6, p {
              margin-top: 0;           /* removing the top margin gets around an issue where margins can escape from their containing block. The remaining bottom margin will hold it away from any elements that follow. */
              padding-right: 15px;
              padding-left: 15px; /* adding the padding to the sides of the elements within the blocks, instead of the block elements themselves, gets rid of any box model math. A nested block with side padding can also be used as an alternate method. */
    a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
              border: none;
    /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    a:link {
              color: #42413C;
              text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    a:visited {
              color: #6E6C64;
              text-decoration: underline;
    a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
              text-decoration: none;
    /* ~~ This fixed width container surrounds all other blocks ~~ */
    .container {
              width: 960px;
              background-color: #FFFFFF;
              margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
    /* ~~ The header is not given a width. It will extend the full width of your layout. ~~ */
    header {
              background-color: #ADB96E;
    /* ~~ These are the columns for the layout. ~~
    1) Padding is only placed on the top and/or bottom of the block elements. The elements within these blocks have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the block itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the block element and place a second block element within it with no width and the padding necessary for your design.
    2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a block set to float right). Many times, padding can be used instead. For blocks where this rule must be broken, you should add a "display:inline" declaration to the block element's rule to tame a bug where some versions of Internet Explorer double the margin.
    3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar blocks could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.
    4) If you prefer your nav on the left instead of the right, simply float these columns the opposite direction (all left instead of all right) and they'll render in reverse order. There's no need to move the blocks around in the HTML source.
    .sidebar1 {
              float: right;
              width: 180px;
              background-color: #EADCAE;
              padding-bottom: 10px;
    .content {
              padding: 10px 0;
              width: 780px;
              float: right;
    /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    .content ul, .content ol {
              padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
    ul.nav {
              list-style: none; /* this removes the list marker */
              border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
              margin-bottom: 15px; /* this creates the space between the navigation on the content below */
    ul.nav li {
              border-bottom: 1px solid #666; /* this creates the button separation */
    ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
              padding: 5px 5px 5px 15px;
              display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */
              width: 160px;  /*this width makes the entire button clickable for IE6. If you don't need to support IE6, it can be removed. Calculate the proper width by subtracting the padding on this link from the width of your sidebar container. */
              text-decoration: none;
              background-color: #C6D580;
    ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
              background-color: #ADB96E;
              color: #FFF;
    /* ~~ The footer ~~ */
    footer {
              padding: 10px 0;
              background-color: #CCC49F;
              position: relative;/* this gives IE6 hasLayout to properly clear */
              clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
    /*HTML 5 support - Sets new HTML 5 tags to display:block so browsers know how to render the tags properly. */
    header, section, footer, aside, article, figure {
              display: block;
    -->
    </style><!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]--></head>
    <body>
    <div class="container">
      <header>
        <p> </p>
      </header>
      <div class="sidebar1">
        <ul class="nav">
          <li><a href="#">Link one</a></li>
          <li><a href="#">Link two</a></li>
          <li><a href="#">Link three</a></li>
          <li><a href="#">Link four</a></li>
        </ul>
        <aside>
          <p> The above links demonstrate a basic navigational structure using an unordered list styled with CSS. Use this as a starting point and modify the properties to produce your own unique look. If you require flyout menus, create your own using a Spry menu, a menu widget from Adobe's Exchange or a variety of other javascript or CSS solutions.</p>
          <p>If you would like the navigation along the top, simply move the ul to the top of the page and recreate the styling.</p>
        </aside>
      <!-- end .sidebar1 --></div>
      <article class="content">
        <h1>Instructions</h1>
        <section>
         <h2>How to use this document</h2>
          <p>Be aware that the CSS for these layouts is heavily commented. If you do most of your work in Design view, have a peek at the code to get tips on working with the CSS for the fixed layouts. You can remove these comments before you launch your site. To learn more about the techniques used in these CSS Layouts, read this article at Adobe's Developer Center - <a href="http://www.adobe.com/go/adc_css_layouts">http://www.adobe.com/go/adc_css_layouts</a>.</p>
        </section>
        <section>
          <h2>Clearing Method</h2>
          <p>Because all the columns are floated, this layout uses a clear:both declaration in the footer rule.  This clearing technique forces the .container to understand where the columns end in order to show any borders or background colors you place on the .container. If your design requires you to remove the footer from the .container, you'll need to use a different clearing method. The most reliable will be to add a &lt;br class=&quot;clearfloat&quot; /&gt; or &lt;div  class=&quot;clearfloat&quot;&gt;&lt;/div&gt; after your final floated column (but before the .container closes). This will have the same clearing effect. </p>
        </section>
        <section>
          <h2>Logo Replacement</h2>
          <p>An image placeholder was used in this layout in the header where you'll likely want to place  a logo. It is recommended that you remove the placeholder and replace it with your own linked logo. </p>
          <p> Be aware that if you use the Property inspector to navigate to your logo image using the SRC field (instead of removing and replacing the placeholder), you should remove the inline background and display properties. These inline styles are only used to make the logo placeholder show up in browsers for demonstration purposes. </p>
          <p>To remove the inline styles, make sure your CSS Styles panel is set to Current. Select the image, and in the Properties pane of the CSS Styles panel, right click and delete the display and background properties. (Of course, you can always go directly into the code and delete the inline styles from the image or placeholder there.)</p>
        </section>
        <section>
          <h2>Backgrounds</h2>
          <p>By nature, the background color on any block element will only show for the length of the content. This means if you're using a background color or border to create the look of a side column, it won't extend all the way to the footer but will stop when the content ends. If the .content block will always contain more content, you can place a border on the .content block to divide it from the column.</p>
        </section>
        <!-- end .content --></article>
      <footer>
        <p>This footer contains the declaration position:relative; to give Internet Explorer 6 hasLayout for the footer and cause it to clear correctly. If you're not required to support IE6, you may remove it.</p>
        <address>
          Address Content
        </address>
      </footer>
      <!-- end .container --></div>
    </body>
    </html>

Maybe you are looking for

  • How to stop Quicklook Satellite from crashing on boot up

    I am running 10.8.2 Mountain Lion on a Mac Pro 3.2GHZ Quad tower, 16GB RAM. About a week ago, I noticed that after every system boot, I am presented with the message that QuickLookSatellite has crashed. I have NOT opted in System Preferences to send

  • Is it possible to change the country in the podcast app?

    I was wondering if it's at all possible to browse podcasts from other countries? For example, I'm learning Swedish and would like to listen to native podcasts, but if you search the word 'swedish' all you get is How to learn ones in English....Any id

  • Slow speeds now, has my IP profile been lowered?

    My broadband has been fine for the past 2 years with a download speed of average 1.3MBs (1300kbp/s) There has been absolutely no changes to the environment in the house, no extensions. My Router is connected to the ADSL filter, connected to the maste

  • Inserting Live Clock in Final Cut Pro Video Project

    Does anyone know how to insert a live clock in FCP? I am looking for something like inserting a game clock for a sporting event. I don't know if this is possible at all, but if so....any tips? Thanks

  • Wrong Answer for substring question?

    This is the question from one of Sun's e-Practice exams. I am only posting it because I believe the answer is wrong. QUESTION: A text field in a GUI allows a user to type in a string, pNum, that represents a telephone number in the following format: