Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Table not updated when value not set

Table not updated when value not set

Scheduled Pinned Locked Moved Database
sharepointoracleannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lionelcyril
    wrote on last edited by
    #1

    I have created a SP and using Oracle 11g. I have declared a variable in a procedure as:

    v_juriscode billingcycle.juriscode%TYPE;

    (an existing type) . . . I have a condition as

    IF n_count > 1
    THEN
    v_juriscode := 'LODESTAR';
    ELSE
    IF n_count = 1
    THEN
    SELECT pm.dejuriscode
    INTO v_juriscode
    FROM pwrline.lsmdphysicalmeter pm
    WHERE pm.decommdevid = V_COMMDEVID;
    END IF;
    END IF;
    UPDATE DEBADGERPROGLOG SET JURISCODE=v_juriscode
    WHERE UIDBADGERPROGLOG = V_UID;

    When the condition c_count = 0 is encountered I have not set the value for juriscode (ie i hv not mentioned that condition). I have noticed that when no value is set to the v_juriscode variable the table row is not updated, I wanted to know why this happens. Thanks in advance.

    Lionel Noronha

    M J 2 Replies Last reply
    0
    • L lionelcyril

      I have created a SP and using Oracle 11g. I have declared a variable in a procedure as:

      v_juriscode billingcycle.juriscode%TYPE;

      (an existing type) . . . I have a condition as

      IF n_count > 1
      THEN
      v_juriscode := 'LODESTAR';
      ELSE
      IF n_count = 1
      THEN
      SELECT pm.dejuriscode
      INTO v_juriscode
      FROM pwrline.lsmdphysicalmeter pm
      WHERE pm.decommdevid = V_COMMDEVID;
      END IF;
      END IF;
      UPDATE DEBADGERPROGLOG SET JURISCODE=v_juriscode
      WHERE UIDBADGERPROGLOG = V_UID;

      When the condition c_count = 0 is encountered I have not set the value for juriscode (ie i hv not mentioned that condition). I have noticed that when no value is set to the v_juriscode variable the table row is not updated, I wanted to know why this happens. Thanks in advance.

      Lionel Noronha

      M Offline
      M Offline
      Md Marufuzzaman
      wrote on last edited by
      #2

      IF n_count > 1
      THEN
      v_juriscode := 'LODESTAR';
      ELSE
      IF n_count = 1
      THEN
      SELECT pm.dejuriscode
      INTO v_juriscode
      FROM pwrline.lsmdphysicalmeter pm
      WHERE pm.decommdevid = V_COMMDEVID;
      END IF;
      END IF;

      IF v\_juriscode IS NOT NULL THEN  
      UPDATE DEBADGERPROGLOG SET JURISCODE=v\_juriscode 
                  WHERE UIDBADGERPROGLOG = V\_UID;
          END IF;
      

      Thanks Md. Marufuzzaman


      I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.

      1 Reply Last reply
      0
      • L lionelcyril

        I have created a SP and using Oracle 11g. I have declared a variable in a procedure as:

        v_juriscode billingcycle.juriscode%TYPE;

        (an existing type) . . . I have a condition as

        IF n_count > 1
        THEN
        v_juriscode := 'LODESTAR';
        ELSE
        IF n_count = 1
        THEN
        SELECT pm.dejuriscode
        INTO v_juriscode
        FROM pwrline.lsmdphysicalmeter pm
        WHERE pm.decommdevid = V_COMMDEVID;
        END IF;
        END IF;
        UPDATE DEBADGERPROGLOG SET JURISCODE=v_juriscode
        WHERE UIDBADGERPROGLOG = V_UID;

        When the condition c_count = 0 is encountered I have not set the value for juriscode (ie i hv not mentioned that condition). I have noticed that when no value is set to the v_juriscode variable the table row is not updated, I wanted to know why this happens. Thanks in advance.

        Lionel Noronha

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        lionelcyril wrote:

        When the condition c_count = 0 is encountered I have not set the value for juriscode (ie i hv not mentioned that condition).
        I have noticed that when no value is set to the v_juriscode variable the table row is not updated, I wanted to know why this happens.

        Precluding the previous answer that statement is contradictory. If the update runs, the where condition is satisfied and no error occurs then an update did happen. There is no alternative. If an update occurs then a value will be updated. There is no such thing a "no value" unless you mean null (presumably you don't mean spaces.) If you didn't set a value then null is used. If you don't want an update if there is no value then use the code from the other response. If you want an update with a different value then set v_juriscode to a default value before you execute the rest of the code.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups