I'm trying to create two tables using the same record, with two different names, but it creates only any one of them or sometimes throws an exception.
Following is the code from my record file:
-record(account,{acctnum, cnic, name, address,date ,time, balance=0}).
Following is my code from module called accounts:
-module(accounts).
-compile(export_all).
-include("records.hrl").
start()->
ets:new(current,[named_table,{keypos, #account.cnic}]),
ets:new(savings,[named_table,{keypos, #account.cnic}]).
Sometimes it returns an atom called savings, but sometimes it gives the following error:
** exception error: bad argument in function ets:new/2 called as ets:new(current,[named_table,{keypos,3}]) in call from accounts:start/0 (accounts.erl, line 5)
Please do let me know that either it's possible to create two tables in ets using a single record? If not, then how can I Implement it, I'm trying to create two tables, one for the savings account and other for the current account, how can I resolve this problem?
privatetable then not more than one per process, else not more than one in total. It has nothing to do with the record name as the contents of the table tuples is just data. - rvirding