Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 631197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:56:19+00:00 2026-05-13T19:56:19+00:00

I have the following: create type customer as object ( id number, name varchar2(10),

  • 0

I have the following:

create type customer as object (
id number, name varchar2(10), points number,
member procedure add_points(num_points number)
) not final;
/

create type body customer as
member procedure add_points(num_points number) is 
begin
   points := points + num_points;
   commit;
end add_points;
end;
/

create table customer_table of customer;
/

insert into customer_table values (customer(123,'joe',10));
/

i then do this is an anonymous block:

declare
cust customer;
begin
select treat(value(c) as customer) into cust from customer_table c where id=123;
c.add_points(100);
end;

but nothing happens – the points value remains at 10.

What have i missed? If i make my member procedure an update...set...commit and pass in the points and a given id, it works.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:56:19+00:00Added an answer on May 13, 2026 at 7:56 pm

    The PL/SQL you posted is invalid. I guess you meant to post this:

    declare
      cust customer;
    begin
      select treat(value(c) as customer) into cust from customer_table c where id=123;
      cust.add_points(100);
    end;
    

    i.e. “cust” not “c” on line 5?

    If so, all you have done there is updated the value of points in the variable cust, not in the table. You can see that like this:

    declare
      cust customer;
    begin
      select treat(value(c) as customer) into cust from customer_table c where id=123;
      cust.add_points(100);
      dbms_output.put_line(cust.points);
    end;
    

    Output:

    110
    

    To update the data in the table does indeed require an UPDATE statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have create the following tables and types.... CREATE TYPE ACTOR_QUOTE_TYPE AS OBJECT (
I have the following statements in Oracle 11g: CREATE TYPE person AS OBJECT (
So I have the following user defined type in my oracle database: CREATE OR
For strongly-typed & type-safe solution, I have to do the following step. Create some
I have the following SP CREATE PROCEDURE GetAllHouses set @webRegionID = 2 set @sortBy
I have the following tables CREATE TABLE `files` ( `fileid` int(11) NOT NULL AUTO_INCREMENT,
First, I have the following table: CREATE TABLE CustomerHub ( CustomerId INT NOT NULL,
So in my postgres DB I have the following custom type: create type my_pg_type
I have the following code to return multiple values from pl/python: CREATE TYPE named_value
I have the following: CREATE TABLE food_delivery ( foodtype varchar(50) NOT NULL, foodname varchar(50)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.