Record Groups , How ?

HI,

I have a product code column  in a detail master(multi records) in which i have to  check the duplication.
I have created a Record Group to check for duplication . There seems to be
some problem. Please have a look at the code and reply.

Thanks

HI, I have added createGroup for creating the RG.
and made changes to code as varchar2(64), still error remains.


DECLARE
rg_name varchar(30) := 'my_group';
rg_id RecordGroup;
gc_id GroupColumn;
errcode number;
code char;
BEGIN
      rg_id := Find_Group(rg_name);
      IF Id_Null(rg_id) THEN
            rg_id := Create_Group(rg_name);
            gc_id := Add_Group_Column(rg_id,'app_code',CHAR_COLUMN,6);
      end if;
      
END;
Code here ......

declare
rg_id RecordGroup;
gc_id GroupColumn;
code char;

BEGIN
      rg_id := Find_group('my_group');
      IF Id_null(rg_id) then
            Message('Record Group '|| 'my_group' || ' does not exist');
      end if;
      gc_id := Find_column('my_group.app_code');
      IF Id_null(gc_id) then
            Message('Column   does not exist');
      end if;
      
Error HERE (FRM-41084 Error Getting Group Cell
-------------------------------------------------------------
             code := Get_Group_Char_Cell('my_group.app_code',1);
      -
      
end;

HArsha
harsshaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sgantaCommented:
Hi,

>> code := Get_Group_Char_Cell('my_group.app_code',1);

I observed that the variable "CODE" is of datatype of CHAR
i.e., length = 1.

Pl. check the data type and maximum length of   "app_code" in
the record group "MY_GROUP" matching with the length of the code.

Probably,

You can do one thing.

Change this statement

code CHAR

to

code  VARCHAR2(64);

and see how it works, Probably this may be the cause.
                 -
0
sgantaCommented:
Hi

Your my_group.app_code may be more than one character.
Please increase the character length of the code.
0
sgantaCommented:
The cause of the error is
FRM-41084:  Error getting Group Cell.

Cause:      Invalid call to GET_GROUP_CHAR_CELL, GET_GROUP_DATE_CELL, OR GET_GROUP_NUMBER_CELL.

Action:      Make sure the column type is of CHAR, DATE, or NUMBER, respectively.  Check the validity of the row number and column name specified.

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

sgantaCommented:

I am sorry, that is not meant for answer
0
harsshaAuthor Commented:
Edited text of question.
0
Mark GeerlingsDatabase AdministratorCommented:
I'm wondering why you use a record group to check for duplicates?  Yes, it will be fast and will not cause network traffic, but don't you need to have a primary or unique key in the database also both to assure uniqueness and to support fast access?  If you are using just the form to check for duplicates, what happens if two people at the same time insert detail records for the same master?  Each set of records may be unique as far as each form knows, but duplicates could be in inserted into the database this way.

A pre-insert trigger that checks the database for uniqueness would also be user-friendly and with proper indexing and a well-tuned network should not add noticeably to the response time.
0
harsshaAuthor Commented:
Thanks a ton for your valuable comments, I have taken care of above points during the Design time.
Written some DB Triggers and Sequences.
When I thouht , I was almost thru with the form , found the need for checking the duplication entries in the form. Shall be grateful to you, if you could give me the solution .


Harsha
0
PFHarrisonCommented:
You are creating your regord group correctly, also the column.

The problem you are faced with is that the ROW needs to be created before you assign a value to it.

Therefore for each row you create call the ADD_GROUP_ROW function.

Below is a working example.
 
Regards

Paul


PROCEDURE testcreate
IS
  rg_name varchar(30) := 'my_group';
  rg_id   RecordGroup;
  gc_id   GroupColumn;
  errcode number;
  code    varchar2(30);
BEGIN
  rg_id := Find_Group(rg_name);

  IF Id_Null(rg_id)
  THEN
    rg_id := Create_Group(rg_name);
  END IF;
 
  gc_id := Find_column('my_group.app_code');
  IF Id_null(gc_id)
  THEN
    gc_id := Add_Group_Column(rg_id,'app_code',CHAR_COLUMN,6);    
  END IF;

  ADD_GROUP_ROW(rg_id, 1);
  SET_GROUP_CHAR_CELL(gc_id,1,'Hello');  
  code := Get_Group_Char_Cell(gc_id,1);

  message (code); pause;
END;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
harsshaAuthor Commented:
Dear PFHarrison,

Thanks a Ton, I acceptyour answer.

It works.

Harsha
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.