Forum OpenACS Development: Creating a new Object in Oracle and OpenACS

I am trying to create a simple object in OpenACS to store a URL to be used for ADP/TCL pages in the WWW directory. I am getting errors while trying to create an object.  The code and more details follow :

The sql file :

begin
  acs_object_type.create_type (
    supertype    => 'acs_object',
    object_type  => 'adppage',
    pretty_name  => 'AdpPage',
    pretty_plural => 'AdpPages',
    table_name    => 'ADPPAGE',
    id_column    => 'PAGE_ID'
  );
end;
/
show errors;

declare
attr_id acs_attributes.attribute_id%TYPE;
begin
  attr_id := acs_attribute.create_attribute (
    object_type    => 'adppage',
    attribute_name => 'URL',
    pretty_name    => 'URL',
    pretty_plural  => 'URLs',
    datatype      => 'string'
  );
end;
/
show errors;

create table adppages (
    page_id    integer references acs_objects(object_id) primary key,
    owner_id  integer references users(user_id),
    url        varchar(255) not null
) ;

create or replace package sdladp
as
  function new (
    page_id            in adppages.page_id%TYPE default null,
    owner_id            in adppages.owner_id%TYPE default null,
    URL                in adppages.url%TYPE,
    object_type        in acs_object_types.object_type%TYPE default 'adppage',
    creation_date      in acs_objects.creation_date%TYPE
                          default sysdate,
    creation_user      in acs_objects.creation_user%TYPE
                          default null,
    creation_ip        in acs_objects.creation_ip%TYPE default null,
    context_id          in acs_objects.context_id%TYPE default null
  ) return adppages.page_id%TYPE;

  procedure delete (
    page_id      in adppages.page_id%TYPE
  );
end sdladp;
/
show errors

create or replace package body sdladp
as

  function new (
    page_id            in adppages.page_id%TYPE default null,
    owner_id            in adppages.owner_id%TYPE default null,
    url                in adppages.url%TYPE,
    object_type        in acs_object_types.object_type%TYPE default 'adppage',
    creation_date      in acs_objects.creation_date%TYPE
                          default sysdate,
    creation_user      in acs_objects.creation_user%TYPE
                          default null,
    creation_ip        in acs_objects.creation_ip%TYPE default null,
    context_id          in acs_objects.context_id%TYPE default null
  ) return adppages.page_id%TYPE
  is
    v_page_id integer;
  begin
    v_page_id := acs_object.new (
      object_id    => page_id,
      object_type  => object_type,
      creation_date => creation_date,
      creation_user => creation_user,
      creation_ip  => creation_ip,
      context_id    => context_id
    );

    insert into adppages
    (page_id, owner_id, url)
    values
    (v_page_id, owner_id, url);

    return v_page_id;
  end new;

procedure delete (
    page_id      in adppages.page_id%TYPE
  )
  is
  begin
    delete from adppages
    where page_id = page_id;

    acs_object.delete(page_id);
  end delete;

end sdladp;
/
show errors;

The Adp page that is calling it :

ad_page_contract {

    This is a test to see if we can use the general comments package with an ADP page
    @Trenton Cameron
    @creation-date
    @cvs-id index.tcl,v 1.3.2.1 2003/04/06 00:29:08 donb Exp

} {
}

set url_list [list URL "here"]

set new_id [package_instantiate_object  -package_name sdladp -var_list url_list adppage]

When I run the adp page I get this error:

ora8.c:3568:ora_tcl_command: error in `OCIStmtExecute ()': ORA-06550: line 4, column 13:
PLS-00306: wrong number or types of arguments in call to 'NEW'
ORA-06550: line 4, column 7:
PL/SQL: Statement ignored

I have also tried calling this procedure directly from a sqlplus command line and I get these varied results:

SQL> exec sdladp.new( null , null , 'this' , null , null , null , null , null );
BEGIN sdladp.new( null , null , 'this' , null , null , null , null , null ); END
;

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00221: 'NEW' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

SQL> exec sdladp.new( url => 'this');
BEGIN sdladp.new( url => 'this'); END;

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00221: 'NEW' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

SQL> exec sdladp.new( );
BEGIN sdladp.new( ); END;

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'NEW'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

If someone could point me in the right direction it would be much appreciated.

  -Thanks in advance
      -Trent

Collapse
Posted by Jarkko Laine on
Hi Trent,

    PLS-00221: 'NEW' is not a procedure or is undefined

Is this because new is a function and you're not putting its return value anywhere?