--------------------------------------------------------
--  File created - Sunday-January-08-2017   
--------------------------------------------------------
DROP TABLE "SWG"."ACCOUNTS" cascade constraints;
DROP TABLE "SWG"."ACCOUNT_EXTRACT" cascade constraints;
DROP TABLE "SWG"."ACCOUNT_INFO" cascade constraints;
DROP TABLE "SWG"."ACCOUNT_MAP" cascade constraints;
DROP TABLE "SWG"."ACCOUNT_REWARD_EVENTS" cascade constraints;
DROP TABLE "SWG"."ACCOUNT_REWARD_ITEMS" cascade constraints;
DROP TABLE "SWG"."ARMOR" cascade constraints;
DROP TABLE "SWG"."AUCTION_LOCATIONS" cascade constraints;
DROP TABLE "SWG"."AUTOMATED_QUERIES" cascade constraints;
DROP TABLE "SWG"."BATTLEFIELD_MARKER_OBJECTS" cascade constraints;
DROP TABLE "SWG"."BATTLEFIELD_PARTICIPANTS" cascade constraints;
DROP TABLE "SWG"."BIOGRAPHIES" cascade constraints;
DROP TABLE "SWG"."BOUNTY_HUNTER_TARGETS" cascade constraints;
DROP TABLE "SWG"."BUILDING_OBJECTS" cascade constraints;
DROP TABLE "SWG"."CELL_OBJECTS" cascade constraints;
DROP TABLE "SWG"."CHARACTER_PROFILE" cascade constraints;
DROP TABLE "SWG"."CHARACTER_TYPES" cascade constraints;
DROP TABLE "SWG"."CITY_OBJECTS" cascade constraints;
DROP TABLE "SWG"."CLOCK" cascade constraints;
DROP TABLE "SWG"."CLUSTER_LIST" cascade constraints;
DROP TABLE "SWG"."CREATURE_OBJECTS" cascade constraints;
DROP TABLE "SWG"."DEFAULT_CHARACTER_SLOTS" cascade constraints;
DROP TABLE "SWG"."DEFAULT_CHAR_LIMITS" cascade constraints;
DROP TABLE "SWG"."DELETE_REASONS" cascade constraints;
DROP TABLE "SWG"."ERRORLOG" cascade constraints;
DROP TABLE "SWG"."ERRORLOG_LEVEL" cascade constraints;
DROP TABLE "SWG"."ERRORLOG_LEVEL_DESC" cascade constraints;
DROP TABLE "SWG"."ERRORLOG_RERAISE_LIMITS" cascade constraints;
DROP TABLE "SWG"."ERRORLOG_VALUES" cascade constraints;
DROP TABLE "SWG"."EXPERIENCE_POINTS" cascade constraints;
DROP TABLE "SWG"."EXTRA_CHARACTER_SLOTS" cascade constraints;
DROP TABLE "SWG"."FACTORY_OBJECTS" cascade constraints;
DROP TABLE "SWG"."FEATURE_ID_TRANSACTIONS" cascade constraints;
DROP TABLE "SWG"."FREE_OBJECT_IDS" cascade constraints;
DROP TABLE "SWG"."GUILD_OBJECTS" cascade constraints;
DROP TABLE "SWG"."HARVESTER_INSTALLATION_OBJECTS" cascade constraints;
DROP TABLE "SWG"."INSTALLATION_OBJECTS" cascade constraints;
DROP TABLE "SWG"."INTANGIBLE_OBJECTS" cascade constraints;
DROP TABLE "SWG"."LOADBEACON_SERVER_MAP" cascade constraints;
DROP TABLE "SWG"."LOCATION_LISTS" cascade constraints;
DROP TABLE "SWG"."MANF_SCHEMATIC_ATTRIBUTES" cascade constraints;
DROP TABLE "SWG"."MANF_SCHEMATIC_OBJECTS" cascade constraints;
DROP TABLE "SWG"."MANUFACTURE_INST_OBJECTS" cascade constraints;
DROP TABLE "SWG"."MARKET_AUCTIONS" cascade constraints;
DROP TABLE "SWG"."MARKET_AUCTION_ATTRIBUTES" cascade constraints;
DROP TABLE "SWG"."MARKET_AUCTION_BIDS" cascade constraints;
DROP TABLE "SWG"."MESSAGES" cascade constraints;
DROP TABLE "SWG"."MISSION_OBJECTS" cascade constraints;
DROP TABLE "SWG"."OBJECTS" cascade constraints;
DROP TABLE "SWG"."OBJECT_LIST" cascade constraints;
DROP TABLE "SWG"."OBJECT_TEMPLATES" cascade constraints;
DROP TABLE "SWG"."OBJECT_VARIABLES" cascade constraints;
DROP TABLE "SWG"."OBJECT_VARIABLE_NAMES" cascade constraints;
DROP TABLE "SWG"."PLANET_OBJECTS" cascade constraints;
DROP TABLE "SWG"."PLAYERS" cascade constraints;
DROP TABLE "SWG"."PLAYER_OBJECTS" cascade constraints;
DROP TABLE "SWG"."PLAYER_QUEST_OBJECTS" cascade constraints;
DROP TABLE "SWG"."PROPERTY_LISTS" cascade constraints;
DROP TABLE "SWG"."PUBLISH_PLAYER_FIXUP" cascade constraints;
DROP TABLE "SWG"."PURGE_ACCOUNTS" cascade constraints;
DROP TABLE "SWG"."PURGE_PHASES" cascade constraints;
DROP TABLE "SWG"."RESOURCE_CONTAINER_OBJECTS" cascade constraints;
DROP TABLE "SWG"."RESOURCE_TYPES" cascade constraints;
DROP TABLE "SWG"."SCRIPTS" cascade constraints;
DROP TABLE "SWG"."SCRUNCHER" cascade constraints;
DROP TABLE "SWG"."SHIP_OBJECTS" cascade constraints;
DROP TABLE "SWG"."STATIC_OBJECTS" cascade constraints;
DROP TABLE "SWG"."STATUSES" cascade constraints;
DROP TABLE "SWG"."SWG_CHARACTERS" cascade constraints;
DROP TABLE "SWG"."TANGIBLE_OBJECTS" cascade constraints;
DROP TABLE "SWG"."TEMP_CHARACTERS" cascade constraints;
DROP TABLE "SWG"."TEMP_FREE_OBJECT_IDS" cascade constraints;
DROP TABLE "SWG"."TOKEN_OBJECTS" cascade constraints;
DROP TABLE "SWG"."UNIVERSE_OBJECTS" cascade constraints;
DROP TABLE "SWG"."VEHICLE_OBJECTS" cascade constraints;
DROP TABLE "SWG"."VERSION_NUMBER" cascade constraints;
DROP TABLE "SWG"."WAYPOINTS" cascade constraints;
DROP TABLE "SWG"."WEAPON_OBJECTS" cascade constraints;
DROP SEQUENCE "SWG"."NEXT_OBJECT_VARIABLE_NAME";
DROP SEQUENCE "SWG"."SEQ_ERRORLOG";
DROP SEQUENCE "SWG"."SEQ_QUERIES";
DROP VIEW "SWG"."CHARACTER_VIEW";
DROP VIEW "SWG"."OBJECTS_VIEW";
DROP VIEW "SWG"."OBJECT_VARIABLES_VIEW";
DROP PACKAGE "SWG"."ADMIN";
DROP PACKAGE "SWG"."BIOGRAPHY";
DROP PACKAGE "SWG"."BLOB_DATA_CONVERSION";
DROP PACKAGE "SWG"."CM_LOADER";
DROP PACKAGE "SWG"."CM_PERSISTER";
DROP PACKAGE "SWG"."CUSTSERV_PROCS";
DROP PACKAGE "SWG"."DATALOOKUP";
DROP PACKAGE "SWG"."DATA_CLEANUP";
DROP PACKAGE "SWG"."DB_ERROR_LOGGER";
DROP PACKAGE "SWG"."GOLD_OVERRIDE";
DROP PACKAGE "SWG"."LAZY_DELETER";
DROP PACKAGE "SWG"."LOADER";
DROP PACKAGE "SWG"."LOGIN";
DROP PACKAGE "SWG"."OBJECTIDMANAGER";
DROP PACKAGE "SWG"."OBJVAR_NAMES";
DROP PACKAGE "SWG"."PERSISTER";
DROP PACKAGE "SWG"."PURGE_METHODS";
DROP PACKAGE "SWG"."PURGE_METHODS2";
DROP PACKAGE "SWG"."PURGE_PROCESS";
DROP PACKAGE "SWG"."SERVERCLOCK";
DROP PACKAGE "SWG"."STATION_PLAYERS";
DROP PACKAGE "SWG"."UNDELETE_METHODS";
DROP PACKAGE "SWG"."UTIL";
DROP PACKAGE BODY "SWG"."ADMIN";
DROP PACKAGE BODY "SWG"."BIOGRAPHY";
DROP PACKAGE BODY "SWG"."BLOB_DATA_CONVERSION";
DROP PACKAGE BODY "SWG"."CM_LOADER";
DROP PACKAGE BODY "SWG"."CM_PERSISTER";
DROP PACKAGE BODY "SWG"."CUSTSERV_PROCS";
DROP PACKAGE BODY "SWG"."DATALOOKUP";
DROP PACKAGE BODY "SWG"."DATA_CLEANUP";
DROP PACKAGE BODY "SWG"."DB_ERROR_LOGGER";
DROP PACKAGE BODY "SWG"."GOLD_OVERRIDE";
DROP PACKAGE BODY "SWG"."LAZY_DELETER";
DROP PACKAGE BODY "SWG"."LOADER";
DROP PACKAGE BODY "SWG"."LOGIN";
DROP PACKAGE BODY "SWG"."OBJECTIDMANAGER";
DROP PACKAGE BODY "SWG"."OBJVAR_NAMES";
DROP PACKAGE BODY "SWG"."PERSISTER";
DROP PACKAGE BODY "SWG"."PURGE_METHODS";
DROP PACKAGE BODY "SWG"."PURGE_METHODS2";
DROP PACKAGE BODY "SWG"."PURGE_PROCESS";
DROP PACKAGE BODY "SWG"."SERVERCLOCK";
DROP PACKAGE BODY "SWG"."STATION_PLAYERS";
DROP PACKAGE BODY "SWG"."UNDELETE_METHODS";
DROP PACKAGE BODY "SWG"."UTIL";
DROP TYPE "SWG"."VAOFLONGSTRING";
DROP TYPE "SWG"."VAOFNUMBER";
DROP TYPE "SWG"."VAOFSTRING";
--------------------------------------------------------
--  DDL for Type VAOFLONGSTRING
--------------------------------------------------------

  CREATE OR REPLACE TYPE "SWG"."VAOFLONGSTRING" is varray(10000) of varchar2(4000);

/

  GRANT EXECUTE ON "SWG"."VAOFLONGSTRING" TO PUBLIC;
--------------------------------------------------------
--  DDL for Type VAOFNUMBER
--------------------------------------------------------

  CREATE OR REPLACE TYPE "SWG"."VAOFNUMBER" is varray(10000) of number;

/

  GRANT EXECUTE ON "SWG"."VAOFNUMBER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Type VAOFSTRING
--------------------------------------------------------

  CREATE OR REPLACE TYPE "SWG"."VAOFSTRING" is varray(10000) of varchar2(1000);

/

  GRANT EXECUTE ON "SWG"."VAOFSTRING" TO PUBLIC;
--------------------------------------------------------
--  DDL for Sequence NEXT_OBJECT_VARIABLE_NAME
--------------------------------------------------------

   CREATE SEQUENCE  "SWG"."NEXT_OBJECT_VARIABLE_NAME"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_ERRORLOG
--------------------------------------------------------

   CREATE SEQUENCE  "SWG"."SEQ_ERRORLOG"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_QUERIES
--------------------------------------------------------

   CREATE SEQUENCE  "SWG"."SEQ_QUERIES"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE  NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Table ACCOUNTS
--------------------------------------------------------

  CREATE TABLE "SWG"."ACCOUNTS" 
   (	"STATION_ID" NUMBER(*,0), 
	"NUM_LOTS" NUMBER(*,0), 
	"IS_OUTCAST" CHAR(1 BYTE), 
	"CHEATER_LEVEL" NUMBER(*,0), 
	"MAX_LOTS_ADJUSTMENT" NUMBER(*,0), 
	"HOUSE_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ACCOUNTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ACCOUNT_EXTRACT
--------------------------------------------------------

  CREATE TABLE "SWG"."ACCOUNT_EXTRACT" 
   (	"USER_ID" NUMBER, 
	"SUBSCRIPTION_ID" NUMBER, 
	"PLAN_ID" NUMBER, 
	"PLAN_DESC" VARCHAR2(255 BYTE), 
	"STATUS" NUMBER, 
	"STATUS_DESC" VARCHAR2(60 BYTE), 
	"CLOSE_DATE" DATE, 
	"TOTAL_ENTITLED_TIME" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ACCOUNT_EXTRACT" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ACCOUNT_INFO
--------------------------------------------------------

  CREATE TABLE "SWG"."ACCOUNT_INFO" 
   (	"STATION_ID" NUMBER, 
	"COMPLETED_TUTORIAL" CHAR(1 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ACCOUNT_INFO" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ACCOUNT_MAP
--------------------------------------------------------

  CREATE TABLE "SWG"."ACCOUNT_MAP" 
   (	"PARENT_ID" NUMBER(38,0), 
	"CHILD_ID" NUMBER(38,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ACCOUNT_MAP" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ACCOUNT_REWARD_EVENTS
--------------------------------------------------------

  CREATE TABLE "SWG"."ACCOUNT_REWARD_EVENTS" 
   (	"STATION_ID" NUMBER, 
	"EVENT_ID" VARCHAR2(255 BYTE), 
	"DATE_CONSUMED" DATE, 
	"CLUSTER_ID" NUMBER, 
	"CHARACTER_ID" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ACCOUNT_REWARD_EVENTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ACCOUNT_REWARD_ITEMS
--------------------------------------------------------

  CREATE TABLE "SWG"."ACCOUNT_REWARD_ITEMS" 
   (	"STATION_ID" NUMBER, 
	"ITEM_ID" VARCHAR2(255 BYTE), 
	"DATE_CLAIMED" DATE, 
	"CLUSTER_ID" NUMBER, 
	"CHARACTER_ID" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ACCOUNT_REWARD_ITEMS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ARMOR
--------------------------------------------------------

  CREATE TABLE "SWG"."ARMOR" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"LAYER" NUMBER(*,0), 
	"EFFECTIVENESS" NUMBER(*,0), 
	"INTEGRITY" NUMBER(*,0), 
	"SPECIAL_PROTECTIONS" VARCHAR2(1000 BYTE), 
	"ENCUMBERANCE_0" NUMBER(*,0), 
	"ENCUMBERANCE_1" NUMBER(*,0), 
	"ENCUMBERANCE_2" NUMBER(*,0), 
	"ENCUMBERANCE_3" NUMBER(*,0), 
	"ENCUMBERANCE_4" NUMBER(*,0), 
	"ENCUMBERANCE_5" NUMBER(*,0), 
	"ENCUMBERANCE_6" NUMBER(*,0), 
	"ENCUMBERANCE_7" NUMBER(*,0), 
	"ENCUMBERANCE_8" NUMBER(*,0), 
	"OBJECT_TEMPLATE" VARCHAR2(255 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ARMOR" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table AUCTION_LOCATIONS
--------------------------------------------------------

  CREATE TABLE "SWG"."AUCTION_LOCATIONS" 
   (	"LOCATION_ID" NUMBER(20,0), 
	"OWNER_ID" NUMBER(20,0), 
	"LOCATION_NAME" VARCHAR2(256 BYTE), 
	"SALES_TAX" NUMBER(20,0) DEFAULT 0, 
	"SALES_TAX_BANK_ID" NUMBER(20,0) DEFAULT 0, 
	"EMPTY_DATE" NUMBER(20,0), 
	"LAST_ACCESS_DATE" NUMBER(20,0), 
	"INACTIVE_DATE" NUMBER(20,0), 
	"STATUS" NUMBER(20,0) DEFAULT 0, 
	"SEARCH_ENABLED" CHAR(1 BYTE) DEFAULT 'Y', 
	"ENTRANCE_CHARGE" NUMBER DEFAULT 0
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."AUCTION_LOCATIONS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table AUTOMATED_QUERIES
--------------------------------------------------------

  CREATE TABLE "SWG"."AUTOMATED_QUERIES" 
   (	"ID" NUMBER(10,0), 
	"STARTTIME" DATE, 
	"ENDTIME" DATE, 
	"CREATETIME" DATE DEFAULT sysdate, 
	"STATUS" VARCHAR2(30 BYTE) DEFAULT 'ready', 
	"TYPE" VARCHAR2(30 BYTE), 
	"RUN_SERIAL" NUMBER(10,0) DEFAULT 0, 
	"EXEC_ORDER" NUMBER(10,0) DEFAULT 0, 
	"QUERY_TEXT" VARCHAR2(4000 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."AUTOMATED_QUERIES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table BATTLEFIELD_MARKER_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."BATTLEFIELD_MARKER_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"REGION_NAME" VARCHAR2(500 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."BATTLEFIELD_MARKER_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table BATTLEFIELD_PARTICIPANTS
--------------------------------------------------------

  CREATE TABLE "SWG"."BATTLEFIELD_PARTICIPANTS" 
   (	"REGION_OBJECT_ID" NUMBER, 
	"CHARACTER_OBJECT_ID" NUMBER, 
	"FACTION_ID" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."BATTLEFIELD_PARTICIPANTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table BIOGRAPHIES
--------------------------------------------------------

  CREATE TABLE "SWG"."BIOGRAPHIES" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"BIOGRAPHY" VARCHAR2(1024 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."BIOGRAPHIES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table BOUNTY_HUNTER_TARGETS
--------------------------------------------------------

  CREATE TABLE "SWG"."BOUNTY_HUNTER_TARGETS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"TARGET_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."BOUNTY_HUNTER_TARGETS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table BUILDING_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."BUILDING_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"MAINTENANCE_COST" NUMBER(*,0), 
	"TIME_LAST_CHECKED" FLOAT(126), 
	"IS_PUBLIC" CHAR(1 BYTE), 
	"CITY_ID" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."BUILDING_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table CELL_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."CELL_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"CELL_NUMBER" NUMBER(*,0), 
	"IS_PUBLIC" CHAR(1 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."CELL_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table CHARACTER_PROFILE
--------------------------------------------------------

  CREATE TABLE "SWG"."CHARACTER_PROFILE" 
   (	"CLUSTER_NAME" VARCHAR2(50 BYTE), 
	"CHARACTER_ID" NUMBER(20,0), 
	"CHARACTER_NAME" VARCHAR2(127 BYTE), 
	"OBJECT_NAME" VARCHAR2(127 BYTE), 
	"X" FLOAT(126), 
	"Y" FLOAT(126), 
	"Z" FLOAT(126), 
	"SCENE_ID" VARCHAR2(50 BYTE), 
	"CASH_BALANCE" NUMBER(*,0), 
	"BANK_BALANCE" NUMBER(*,0), 
	"OBJECT_TEMPLATE_NAME" VARCHAR2(500 BYTE), 
	"STATION_ID" NUMBER(20,0), 
	"CONTAINED_BY" NUMBER(20,0), 
	"CREATE_TIME" DATE, 
	"PLAYED_TIME" DATE, 
	"NUM_LOTS" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."CHARACTER_PROFILE" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table CHARACTER_TYPES
--------------------------------------------------------

  CREATE TABLE "SWG"."CHARACTER_TYPES" 
   (	"ID" NUMBER, 
	"DESCRIPTION" VARCHAR2(1000 BYTE)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."CHARACTER_TYPES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table CITY_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."CITY_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."CITY_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table CLOCK
--------------------------------------------------------

  CREATE TABLE "SWG"."CLOCK" 
   (	"LAST_SAVE_TIME" NUMBER(*,0), 
	"LAST_SAVE_TIMESTAMP" DATE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."CLOCK" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table CLUSTER_LIST
--------------------------------------------------------

  CREATE TABLE "SWG"."CLUSTER_LIST" 
   (	"ID" NUMBER, 
	"NAME" VARCHAR2(255 BYTE), 
	"NUM_CHARACTERS" NUMBER, 
	"ADDRESS" VARCHAR2(255 BYTE), 
	"PORT" NUMBER DEFAULT 44463, 
	"SECRET" CHAR(1 BYTE), 
	"LOCKED" CHAR(1 BYTE), 
	"NOT_RECOMMENDED" CHAR(1 BYTE), 
	"GROUP_ID" NUMBER(*,0) DEFAULT 1, 
	"ONLINE_PLAYER_LIMIT" NUMBER DEFAULT 100, 
	"ONLINE_FREE_TRIAL_LIMIT" NUMBER, 
	"FREE_TRIAL_CAN_CREATE_CHAR" CHAR(1 BYTE), 
	"ONLINE_TUTORIAL_LIMIT" NUMBER DEFAULT 350
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."CLUSTER_LIST" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table CREATURE_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."CREATURE_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"SCALE_FACTOR" FLOAT(126), 
	"STATES" NUMBER(*,0), 
	"POSTURE" NUMBER(*,0), 
	"SHOCK_WOUNDS" NUMBER(*,0), 
	"MASTER_ID" NUMBER(20,0), 
	"RANK" NUMBER(*,0), 
	"BASE_WALK_SPEED" FLOAT(126), 
	"BASE_RUN_SPEED" FLOAT(126), 
	"ATTRIBUTE_0" NUMBER(*,0), 
	"ATTRIBUTE_1" NUMBER(*,0), 
	"ATTRIBUTE_2" NUMBER(*,0), 
	"ATTRIBUTE_3" NUMBER(*,0), 
	"ATTRIBUTE_4" NUMBER(*,0), 
	"ATTRIBUTE_5" NUMBER(*,0), 
	"ATTRIBUTE_6" NUMBER(*,0), 
	"ATTRIBUTE_7" NUMBER(*,0), 
	"ATTRIBUTE_8" NUMBER(*,0), 
	"ATTRIBUTE_9" NUMBER(*,0), 
	"ATTRIBUTE_10" NUMBER(*,0), 
	"ATTRIBUTE_11" NUMBER(*,0), 
	"ATTRIBUTE_12" NUMBER(*,0), 
	"ATTRIBUTE_13" NUMBER(*,0), 
	"ATTRIBUTE_14" NUMBER(*,0), 
	"ATTRIBUTE_15" NUMBER(*,0), 
	"ATTRIBUTE_16" NUMBER(*,0), 
	"ATTRIBUTE_17" NUMBER(*,0), 
	"ATTRIBUTE_18" NUMBER(*,0), 
	"ATTRIBUTE_19" NUMBER(*,0), 
	"ATTRIBUTE_20" NUMBER(*,0), 
	"ATTRIBUTE_21" NUMBER(*,0), 
	"ATTRIBUTE_22" NUMBER(*,0), 
	"ATTRIBUTE_23" NUMBER(*,0), 
	"ATTRIBUTE_24" NUMBER(*,0), 
	"ATTRIBUTE_25" NUMBER(*,0), 
	"ATTRIBUTE_26" NUMBER(*,0), 
	"PERSISTED_BUFFS" VARCHAR2(1000 BYTE), 
	"WS_X" FLOAT(126), 
	"WS_Y" FLOAT(126), 
	"WS_Z" FLOAT(126)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."CREATURE_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table DEFAULT_CHARACTER_SLOTS
--------------------------------------------------------

  CREATE TABLE "SWG"."DEFAULT_CHARACTER_SLOTS" 
   (	"CHARACTER_TYPE_ID" NUMBER, 
	"NUM_SLOTS" NUMBER
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."DEFAULT_CHARACTER_SLOTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table DEFAULT_CHAR_LIMITS
--------------------------------------------------------

  CREATE TABLE "SWG"."DEFAULT_CHAR_LIMITS" 
   (	"ACCOUNT_LIMIT" NUMBER, 
	"CLUSTER_LIMIT" NUMBER
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."DEFAULT_CHAR_LIMITS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table DELETE_REASONS
--------------------------------------------------------

  CREATE TABLE "SWG"."DELETE_REASONS" 
   (	"REASON_CODE" NUMBER, 
	"TAG" VARCHAR2(100 BYTE), 
	"DESCRIPTION" VARCHAR2(1000 BYTE)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."DELETE_REASONS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ERRORLOG
--------------------------------------------------------

  CREATE TABLE "SWG"."ERRORLOG" 
   (	"ERROR_ID" NUMBER(20,0), 
	"TIMESTAMP" DATE DEFAULT SYSDATE, 
	"ORA_ERRNO" NUMBER(10,0), 
	"ORA_ERRMSG" VARCHAR2(255 BYTE), 
	"SCHEMA_NAME" VARCHAR2(30 BYTE), 
	"MODULE_NAME" VARCHAR2(80 BYTE), 
	"NOTES" VARCHAR2(4000 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ERRORLOG" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ERRORLOG_LEVEL
--------------------------------------------------------

  CREATE TABLE "SWG"."ERRORLOG_LEVEL" 
   (	"LEVELID" NUMBER(10,0) DEFAULT 0
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ERRORLOG_LEVEL" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ERRORLOG_LEVEL_DESC
--------------------------------------------------------

  CREATE TABLE "SWG"."ERRORLOG_LEVEL_DESC" 
   (	"LEVELID" NUMBER(10,0) DEFAULT 0, 
	"DESCRIP" VARCHAR2(50 BYTE)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ERRORLOG_LEVEL_DESC" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ERRORLOG_RERAISE_LIMITS
--------------------------------------------------------

  CREATE TABLE "SWG"."ERRORLOG_RERAISE_LIMITS" 
   (	"PACKAGE" VARCHAR2(30 BYTE), 
	"PROCEDURE" VARCHAR2(30 BYTE), 
	"ERRORLIMIT" NUMBER(10,0) DEFAULT 0, 
	"ERRORCOUNT" NUMBER(10,0) DEFAULT 0, 
	"UNLIMITED_FLAG" NUMBER(10,0) DEFAULT 0
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ERRORLOG_RERAISE_LIMITS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table ERRORLOG_VALUES
--------------------------------------------------------

  CREATE TABLE "SWG"."ERRORLOG_VALUES" 
   (	"ERROR_ID" NUMBER(20,0), 
	"ELEMENT_OWNER" VARCHAR2(30 BYTE), 
	"ELEMENT_NAME" VARCHAR2(30 BYTE), 
	"ELEMENT_TYPE" VARCHAR2(30 BYTE), 
	"ELEMENT_VALUE" VARCHAR2(4000 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."ERRORLOG_VALUES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table EXPERIENCE_POINTS
--------------------------------------------------------

  CREATE TABLE "SWG"."EXPERIENCE_POINTS" 
   (	"OBJECT_ID" NUMBER, 
	"EXPERIENCE_TYPE" VARCHAR2(500 BYTE), 
	"POINTS" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."EXPERIENCE_POINTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table EXTRA_CHARACTER_SLOTS
--------------------------------------------------------

  CREATE TABLE "SWG"."EXTRA_CHARACTER_SLOTS" 
   (	"STATION_ID" NUMBER, 
	"CLUSTER_ID" NUMBER, 
	"CHARACTER_TYPE_ID" NUMBER, 
	"NUM_EXTRA_SLOTS" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."EXTRA_CHARACTER_SLOTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table FACTORY_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."FACTORY_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."FACTORY_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table FEATURE_ID_TRANSACTIONS
--------------------------------------------------------

  CREATE TABLE "SWG"."FEATURE_ID_TRANSACTIONS" 
   (	"STATION_ID" NUMBER, 
	"CLUSTER_ID" NUMBER, 
	"CHARACTER_ID" NUMBER, 
	"ITEM_ID" VARCHAR2(255 BYTE), 
	"DATE_UPDATED" DATE, 
	"COUNT" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."FEATURE_ID_TRANSACTIONS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table FREE_OBJECT_IDS
--------------------------------------------------------

  CREATE TABLE "SWG"."FREE_OBJECT_IDS" 
   (	"START_ID" NUMBER(*,0), 
	"END_ID" NUMBER(*,0)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."FREE_OBJECT_IDS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table GUILD_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."GUILD_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."GUILD_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table HARVESTER_INSTALLATION_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."HARVESTER_INSTALLATION_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"INSTALLED_EFFICIENCY" FLOAT(126), 
	"MAX_EXTRACTION_RATE" NUMBER(*,0), 
	"CURRENT_EXTRACTION_RATE" FLOAT(126), 
	"MAX_HOPPER_AMOUNT" NUMBER(*,0), 
	"HOPPER_RESOURCE" NUMBER(20,0), 
	"HOPPER_AMOUNT" FLOAT(126), 
	"RESOURCE_TYPE" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."HARVESTER_INSTALLATION_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table INSTALLATION_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."INSTALLATION_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"INSTALLATION_TYPE" NUMBER(*,0), 
	"ACTIVATED" CHAR(1 BYTE), 
	"TICK_COUNT" FLOAT(126), 
	"ACTIVATE_START_TIME" FLOAT(126), 
	"POWER" FLOAT(126), 
	"POWER_RATE" FLOAT(126)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."INSTALLATION_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table INTANGIBLE_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."INTANGIBLE_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"COUNT" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."INTANGIBLE_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table LOADBEACON_SERVER_MAP
--------------------------------------------------------

  CREATE TABLE "SWG"."LOADBEACON_SERVER_MAP" 
   (	"OBJECT_TEMPLATE" VARCHAR2(255 BYTE), 
	"SERVER_ID" NUMBER(*,0), 
	"SECONDARY_SERVER_ID" NUMBER(*,0)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."LOADBEACON_SERVER_MAP" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table LOCATION_LISTS
--------------------------------------------------------

  CREATE TABLE "SWG"."LOCATION_LISTS" 
   (	"OBJECT_ID" NUMBER, 
	"LIST_ID" NUMBER, 
	"SEQUENCE_NUMBER" NUMBER, 
	"NAME" VARCHAR2(255 BYTE), 
	"SCENE" VARCHAR2(50 BYTE), 
	"X" NUMBER, 
	"Y" NUMBER, 
	"Z" NUMBER, 
	"RADIUS" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."LOCATION_LISTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table MANF_SCHEMATIC_ATTRIBUTES
--------------------------------------------------------

  CREATE TABLE "SWG"."MANF_SCHEMATIC_ATTRIBUTES" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"ATTRIBUTE_TYPE" VARCHAR2(500 BYTE), 
	"VALUE" FLOAT(126)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."MANF_SCHEMATIC_ATTRIBUTES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table MANF_SCHEMATIC_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."MANF_SCHEMATIC_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"CREATOR_ID" NUMBER, 
	"CREATOR_NAME" VARCHAR2(127 BYTE), 
	"ITEMS_PER_CONTAINER" NUMBER(*,0), 
	"MANUFACTURE_TIME" FLOAT(126), 
	"DRAFT_SCHEMATIC" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."MANF_SCHEMATIC_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table MANUFACTURE_INST_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."MANUFACTURE_INST_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."MANUFACTURE_INST_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table MARKET_AUCTIONS
--------------------------------------------------------

  CREATE TABLE "SWG"."MARKET_AUCTIONS" 
   (	"ITEM_ID" NUMBER(20,0), 
	"LOCATION_ID" NUMBER(20,0), 
	"CREATOR_ID" NUMBER(20,0), 
	"OWNER_ID" NUMBER(20,0), 
	"MIN_BID" NUMBER(20,0), 
	"BUY_NOW_PRICE" NUMBER(20,0), 
	"AUCTION_TIMER" NUMBER(20,0), 
	"USER_DESCRIPTION" VARCHAR2(4000 BYTE), 
	"ITEM_NAME" VARCHAR2(4000 BYTE), 
	"OOB" VARCHAR2(4000 BYTE), 
	"CATEGORY" NUMBER(20,0), 
	"ITEM_TIMER" NUMBER(20,0), 
	"ACTIVE" NUMBER(20,0), 
	"ITEM_SIZE" NUMBER(20,0) DEFAULT 1, 
	"OBJECT_TEMPLATE_ID" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."MARKET_AUCTIONS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table MARKET_AUCTION_ATTRIBUTES
--------------------------------------------------------

  CREATE TABLE "SWG"."MARKET_AUCTION_ATTRIBUTES" 
   (	"ITEM_ID" NUMBER(20,0), 
	"ATTRIBUTE_NAME" VARCHAR2(1000 BYTE), 
	"ATTRIBUTE_VALUE" VARCHAR2(1000 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."MARKET_AUCTION_ATTRIBUTES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table MARKET_AUCTION_BIDS
--------------------------------------------------------

  CREATE TABLE "SWG"."MARKET_AUCTION_BIDS" 
   (	"ITEM_ID" NUMBER(20,0), 
	"BIDDER_ID" NUMBER(20,0), 
	"BID" NUMBER(20,0), 
	"MAX_PROXY_BID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."MARKET_AUCTION_BIDS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table MESSAGES
--------------------------------------------------------

  CREATE TABLE "SWG"."MESSAGES" 
   (	"MESSAGE_ID" NUMBER(*,0), 
	"TARGET" NUMBER(*,0), 
	"METHOD" VARCHAR2(50 BYTE), 
	"DATA" VARCHAR2(4000 BYTE), 
	"CALL_TIME" NUMBER(*,0), 
	"GUARANTEED" CHAR(1 BYTE), 
	"DELIVERY_TYPE" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."MESSAGES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table MISSION_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."MISSION_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"DIFFICULTY" NUMBER(*,0), 
	"END_X" FLOAT(126), 
	"END_Y" FLOAT(126), 
	"END_Z" FLOAT(126), 
	"END_CELL" NUMBER(20,0), 
	"END_SCENE" NUMBER(*,0), 
	"MISSION_CREATOR" VARCHAR2(127 BYTE), 
	"REWARD" NUMBER(*,0), 
	"ROOT_SCRIPT_NAME" VARCHAR2(100 BYTE), 
	"START_X" FLOAT(126), 
	"START_Y" FLOAT(126), 
	"START_Z" FLOAT(126), 
	"START_CELL" NUMBER(20,0), 
	"START_SCENE" NUMBER(*,0), 
	"DESCRIPTION_TABLE" VARCHAR2(100 BYTE), 
	"DESCRIPTION_TEXT" VARCHAR2(100 BYTE), 
	"TITLE_TABLE" VARCHAR2(100 BYTE), 
	"TITLE_TEXT" VARCHAR2(100 BYTE), 
	"MISSION_HOLDER_ID" NUMBER(20,0), 
	"STATUS" NUMBER(*,0), 
	"MISSION_TYPE" NUMBER(*,0), 
	"TARGET_APPEARANCE" NUMBER(*,0), 
	"TARGET_NAME" VARCHAR2(127 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."MISSION_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"X" FLOAT(126), 
	"Y" FLOAT(126), 
	"Z" FLOAT(126), 
	"QUATERNION_W" FLOAT(126), 
	"QUATERNION_X" FLOAT(126), 
	"QUATERNION_Y" FLOAT(126), 
	"QUATERNION_Z" FLOAT(126), 
	"NODE_X" NUMBER(*,0), 
	"NODE_Y" NUMBER(*,0), 
	"NODE_Z" NUMBER(*,0), 
	"TYPE_ID" NUMBER(*,0), 
	"SCENE_ID" VARCHAR2(50 BYTE), 
	"CONTROLLER_TYPE" NUMBER(*,0), 
	"DELETED" NUMBER(*,0), 
	"OBJECT_NAME" VARCHAR2(127 BYTE), 
	"VOLUME" NUMBER(*,0), 
	"CONTAINED_BY" NUMBER(20,0), 
	"SLOT_ARRANGEMENT" NUMBER(*,0), 
	"PLAYER_CONTROLLED" CHAR(1 BYTE), 
	"CACHE_VERSION" NUMBER(*,0), 
	"LOAD_CONTENTS" CHAR(1 BYTE), 
	"CASH_BALANCE" NUMBER(*,0), 
	"BANK_BALANCE" NUMBER(*,0), 
	"COMPLEXITY" FLOAT(126), 
	"NAME_STRING_TABLE" VARCHAR2(500 BYTE), 
	"NAME_STRING_TEXT" VARCHAR2(500 BYTE), 
	"OBJECT_TEMPLATE_ID" NUMBER(*,0), 
	"STATIC_ITEM_NAME" VARCHAR2(128 BYTE), 
	"STATIC_ITEM_VERSION" NUMBER(*,0), 
	"CONVERSION_ID" NUMBER(*,0), 
	"DELETED_DATE" DATE, 
	"LOAD_WITH" NUMBER(20,0), 
	"OBJVAR_0_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_0_TYPE" NUMBER(*,0), 
	"OBJVAR_0_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_1_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_1_TYPE" NUMBER(*,0), 
	"OBJVAR_1_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_2_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_2_TYPE" NUMBER(*,0), 
	"OBJVAR_2_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_3_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_3_TYPE" NUMBER(*,0), 
	"OBJVAR_3_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_4_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_4_TYPE" NUMBER(*,0), 
	"OBJVAR_4_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_5_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_5_TYPE" NUMBER(*,0), 
	"OBJVAR_5_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_6_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_6_TYPE" NUMBER(*,0), 
	"OBJVAR_6_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_7_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_7_TYPE" NUMBER(*,0), 
	"OBJVAR_7_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_8_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_8_TYPE" NUMBER(*,0), 
	"OBJVAR_8_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_9_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_9_TYPE" NUMBER(*,0), 
	"OBJVAR_9_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_10_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_10_TYPE" NUMBER(*,0), 
	"OBJVAR_10_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_11_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_11_TYPE" NUMBER(*,0), 
	"OBJVAR_11_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_12_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_12_TYPE" NUMBER(*,0), 
	"OBJVAR_12_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_13_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_13_TYPE" NUMBER(*,0), 
	"OBJVAR_13_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_14_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_14_TYPE" NUMBER(*,0), 
	"OBJVAR_14_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_15_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_15_TYPE" NUMBER(*,0), 
	"OBJVAR_15_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_16_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_16_TYPE" NUMBER(*,0), 
	"OBJVAR_16_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_17_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_17_TYPE" NUMBER(*,0), 
	"OBJVAR_17_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_18_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_18_TYPE" NUMBER(*,0), 
	"OBJVAR_18_VALUE" VARCHAR2(50 BYTE), 
	"OBJVAR_19_NAME" VARCHAR2(50 BYTE), 
	"OBJVAR_19_TYPE" NUMBER(*,0), 
	"OBJVAR_19_VALUE" VARCHAR2(50 BYTE), 
	"SCRIPT_LIST" VARCHAR2(2000 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table OBJECT_LIST
--------------------------------------------------------

  CREATE GLOBAL TEMPORARY TABLE "SWG"."OBJECT_LIST" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"CONTAINER_LEVEL" NUMBER
   ) ON COMMIT DELETE ROWS ;
  GRANT ALTER, DELETE, INDEX, INSERT, SELECT, UPDATE, REFERENCES, ON COMMIT REFRESH, QUERY REWRITE, DEBUG, FLASHBACK ON "SWG"."OBJECT_LIST" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table OBJECT_TEMPLATES
--------------------------------------------------------

  CREATE TABLE "SWG"."OBJECT_TEMPLATES" 
   (	"ID" NUMBER, 
	"NAME" VARCHAR2(255 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."OBJECT_TEMPLATES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table OBJECT_VARIABLES
--------------------------------------------------------

  CREATE TABLE "SWG"."OBJECT_VARIABLES" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"NAME_ID" NUMBER, 
	"TYPE" NUMBER(*,0), 
	"VALUE" VARCHAR2(1000 BYTE), 
	"DETACHED" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."OBJECT_VARIABLES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table OBJECT_VARIABLE_NAMES
--------------------------------------------------------

  CREATE TABLE "SWG"."OBJECT_VARIABLE_NAMES" 
   (	"ID" NUMBER(20,0), 
	"NAME" VARCHAR2(500 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."OBJECT_VARIABLE_NAMES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table PLANET_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."PLANET_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"PLANET_NAME" VARCHAR2(100 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."PLANET_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table PLAYERS
--------------------------------------------------------

  CREATE TABLE "SWG"."PLAYERS" 
   (	"CHARACTER_OBJECT" NUMBER(*,0), 
	"STATION_ID" NUMBER(*,0), 
	"UC_CHARACTER_NAME" VARCHAR2(127 BYTE), 
	"CHARACTER_FULL_NAME" VARCHAR2(127 BYTE), 
	"CREATE_TIME" DATE, 
	"LAST_LOGIN_TIME" DATE DEFAULT sysdate
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."PLAYERS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table PLAYER_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."PLAYER_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"STATION_ID" NUMBER(*,0), 
	"PERSONAL_PROFILE_ID" VARCHAR2(200 BYTE), 
	"CHARACTER_PROFILE_ID" VARCHAR2(200 BYTE), 
	"SKILL_TITLE" VARCHAR2(200 BYTE), 
	"BORN_DATE" NUMBER(*,0), 
	"PLAYED_TIME" NUMBER(*,0), 
	"FORCE_REGEN_RATE" FLOAT(126), 
	"FORCE_POWER" NUMBER(*,0), 
	"MAX_FORCE_POWER" NUMBER(*,0), 
	"NUM_LOTS" NUMBER(*,0), 
	"ACTIVE_QUESTS" VARCHAR2(512 BYTE), 
	"COMPLETED_QUESTS" VARCHAR2(512 BYTE), 
	"CURRENT_QUEST" NUMBER(*,0), 
	"QUESTS" VARCHAR2(4000 BYTE), 
	"ROLE_ICON_CHOICE" NUMBER(*,0), 
	"QUESTS2" VARCHAR2(4000 BYTE), 
	"QUESTS3" VARCHAR2(4000 BYTE), 
	"QUESTS4" VARCHAR2(4000 BYTE), 
	"SKILL_TEMPLATE" VARCHAR2(200 BYTE), 
	"WORKING_SKILL" VARCHAR2(200 BYTE), 
	"CURRENT_GCW_POINTS" NUMBER(*,0), 
	"CURRENT_GCW_RATING" NUMBER(*,0), 
	"CURRENT_PVP_KILLS" NUMBER(*,0), 
	"LIFETIME_GCW_POINTS" NUMBER(*,0), 
	"MAX_GCW_IMPERIAL_RATING" NUMBER(*,0), 
	"MAX_GCW_REBEL_RATING" NUMBER(*,0), 
	"LIFETIME_PVP_KILLS" NUMBER(*,0), 
	"NEXT_GCW_RATING_CALC_TIME" NUMBER(*,0), 
	"COLLECTIONS" VARCHAR2(4000 BYTE), 
	"SHOW_BACKPACK" CHAR(1 BYTE), 
	"SHOW_HELMET" CHAR(1 BYTE), 
	"COLLECTIONS2" VARCHAR2(4000 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."PLAYER_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table PLAYER_QUEST_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."PLAYER_QUEST_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"TITLE" VARCHAR2(256 BYTE), 
	"DESCRIPTION" VARCHAR2(4000 BYTE), 
	"CREATOR" NUMBER(20,0), 
	"TOTAL_TASKS" NUMBER(*,0), 
	"DIFFICULTY" NUMBER(*,0), 
	"TASK_TITLE1" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION1" VARCHAR2(4000 BYTE), 
	"TASK_TITLE2" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION2" VARCHAR2(4000 BYTE), 
	"TASK_TITLE3" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION3" VARCHAR2(4000 BYTE), 
	"TASK_TITLE4" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION4" VARCHAR2(4000 BYTE), 
	"TASK_TITLE5" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION5" VARCHAR2(4000 BYTE), 
	"TASK_TITLE6" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION6" VARCHAR2(4000 BYTE), 
	"TASK_TITLE7" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION7" VARCHAR2(4000 BYTE), 
	"TASK_TITLE8" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION8" VARCHAR2(4000 BYTE), 
	"TASK_TITLE9" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION9" VARCHAR2(4000 BYTE), 
	"TASK_TITLE10" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION10" VARCHAR2(4000 BYTE), 
	"TASK_TITLE11" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION11" VARCHAR2(4000 BYTE), 
	"TASK_TITLE12" VARCHAR2(128 BYTE), 
	"TASK_DESCRIPTION12" VARCHAR2(4000 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."PLAYER_QUEST_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table PROPERTY_LISTS
--------------------------------------------------------

  CREATE TABLE "SWG"."PROPERTY_LISTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"LIST_ID" NUMBER(*,0), 
	"VALUE" VARCHAR2(500 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."PROPERTY_LISTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table PUBLISH_PLAYER_FIXUP
--------------------------------------------------------

  CREATE TABLE "SWG"."PUBLISH_PLAYER_FIXUP" 
   (	"PLAYER_OBJECT_ID" NUMBER(20,0), 
	"X" NUMBER, 
	"Y" NUMBER, 
	"Z" NUMBER
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."PUBLISH_PLAYER_FIXUP" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table PURGE_ACCOUNTS
--------------------------------------------------------

  CREATE TABLE "SWG"."PURGE_ACCOUNTS" 
   (	"STATION_ID" NUMBER, 
	"PURGE_PHASE" NUMBER, 
	"PURGE_START_DATE" DATE, 
	"PURGE_PHASE_DATE" DATE, 
	"PURGE_LOCK" DATE
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."PURGE_ACCOUNTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table PURGE_PHASES
--------------------------------------------------------

  CREATE TABLE "SWG"."PURGE_PHASES" 
   (	"ID" NUMBER, 
	"DESCRIPTION" VARCHAR2(200 BYTE)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."PURGE_PHASES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table RESOURCE_CONTAINER_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."RESOURCE_CONTAINER_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"RESOURCE_TYPE" NUMBER(20,0), 
	"QUANTITY" NUMBER(*,0), 
	"SOURCE" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."RESOURCE_CONTAINER_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table RESOURCE_TYPES
--------------------------------------------------------

  CREATE TABLE "SWG"."RESOURCE_TYPES" 
   (	"RESOURCE_ID" NUMBER(20,0), 
	"RESOURCE_NAME" VARCHAR2(100 BYTE), 
	"RESOURCE_CLASS" VARCHAR2(100 BYTE), 
	"ATTRIBUTES" VARCHAR2(1024 BYTE), 
	"FRACTAL_SEEDS" VARCHAR2(1024 BYTE), 
	"DEPLETED_TIMESTAMP" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."RESOURCE_TYPES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table SCRIPTS
--------------------------------------------------------

  CREATE TABLE "SWG"."SCRIPTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"SEQUENCE_NO" NUMBER(*,0), 
	"SCRIPT" VARCHAR2(100 BYTE), 
	"DETACHED" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."SCRIPTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table SCRUNCHER
--------------------------------------------------------

  CREATE TABLE "SWG"."SCRUNCHER" 
   (	"NEW_OBJECT_ID" NUMBER(20,0), 
	"OLD_OBJECT_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."SCRUNCHER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table SHIP_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."SHIP_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"SLIDE_DAMPENER" FLOAT(126), 
	"CURRENT_CHASSIS_HIT_POINTS" FLOAT(126), 
	"MAXIMUM_CHASSIS_HIT_POINTS" FLOAT(126), 
	"CHASSIS_TYPE" NUMBER(*,0), 
	"CMP_ARMOR_HP_MAXIMUM" VARCHAR2(400 BYTE), 
	"CMP_ARMOR_HP_CURRENT" VARCHAR2(400 BYTE), 
	"CMP_EFFICIENCY_GENERAL" VARCHAR2(400 BYTE), 
	"CMP_EFFICIENCY_ENG" VARCHAR2(400 BYTE), 
	"CMP_ENG_MAINTENANCE" VARCHAR2(400 BYTE), 
	"CMP_MASS" VARCHAR2(400 BYTE), 
	"CMP_CRC" VARCHAR2(500 BYTE), 
	"CMP_HP_CURRENT" VARCHAR2(400 BYTE), 
	"CMP_HP_MAXIMUM" VARCHAR2(400 BYTE), 
	"CMP_FLAGS" VARCHAR2(400 BYTE), 
	"CMP_NAMES" VARCHAR2(4000 BYTE), 
	"WEAPON_DAMAGE_MAXIMUM" VARCHAR2(400 BYTE), 
	"WEAPON_DAMAGE_MINIMUM" VARCHAR2(400 BYTE), 
	"WEAPON_EFFECTIVENESS_SHIELDS" VARCHAR2(400 BYTE), 
	"WEAPON_EFFECTIVENESS_ARMOR" VARCHAR2(400 BYTE), 
	"WEAPON_ENG_PER_SHOT" VARCHAR2(400 BYTE), 
	"WEAPON_REFIRE_RATE" VARCHAR2(400 BYTE), 
	"WEAPON_AMMO_CURRENT" VARCHAR2(400 BYTE), 
	"WEAPON_AMMO_MAXIMUM" VARCHAR2(400 BYTE), 
	"WEAPON_AMMO_TYPE" VARCHAR2(400 BYTE), 
	"SHIELD_HP_FRONT_MAXIMUM" FLOAT(126), 
	"SHIELD_HP_BACK_MAXIMUM" FLOAT(126), 
	"SHIELD_RECHARGE_RATE" FLOAT(126), 
	"CAPACITOR_ENG_MAXIMUM" FLOAT(126), 
	"CAPACITOR_ENG_RECHARGE_RATE" FLOAT(126), 
	"ENGINE_ACC_RATE" FLOAT(126), 
	"ENGINE_DECELERATION_RATE" FLOAT(126), 
	"ENGINE_PITCH_ACC_RATE" FLOAT(126), 
	"ENGINE_YAW_ACC_RATE" FLOAT(126), 
	"ENGINE_ROLL_ACC_RATE" FLOAT(126), 
	"ENGINE_PITCH_RATE_MAXIMUM" FLOAT(126), 
	"ENGINE_YAW_RATE_MAXIMUM" FLOAT(126), 
	"ENGINE_ROLL_RATE_MAXIMUM" FLOAT(126), 
	"ENGINE_SPEED_MAXIMUM" FLOAT(126), 
	"REACTOR_ENG_GENERATION_RATE" FLOAT(126), 
	"BOOSTER_ENG_MAXIMUM" FLOAT(126), 
	"BOOSTER_ENG_RECHARGE_RATE" FLOAT(126), 
	"BOOSTER_ENG_CONSUMPTION_RATE" FLOAT(126), 
	"BOOSTER_ACC" FLOAT(126), 
	"BOOSTER_SPEED_MAXIMUM" FLOAT(126), 
	"DROID_IF_CMD_SPEED" FLOAT(126), 
	"INSTALLED_DCD" NUMBER(20,0), 
	"CHASSIS_CMP_MASS_MAXIMUM" FLOAT(126), 
	"CMP_CREATORS" VARCHAR2(400 BYTE), 
	"CARGO_HOLD_CONTENTS_MAXIMUM" NUMBER, 
	"CARGO_HOLD_CONTENTS_CURRENT" NUMBER, 
	"CARGO_HOLD_CONTENTS" VARCHAR2(500 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."SHIP_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table STATIC_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."STATIC_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."STATIC_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table STATUSES
--------------------------------------------------------

  CREATE TABLE "SWG"."STATUSES" 
   (	"ID" NUMBER, 
	"DESCRIPTION" VARCHAR2(200 BYTE), 
	"DO_PURGE" CHAR(1 BYTE), 
	"REVIEWED" CHAR(1 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."STATUSES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table SWG_CHARACTERS
--------------------------------------------------------

  CREATE TABLE "SWG"."SWG_CHARACTERS" 
   (	"STATION_ID" NUMBER, 
	"CLUSTER_ID" NUMBER, 
	"CHARACTER_NAME" VARCHAR2(127 BYTE), 
	"OBJECT_ID" NUMBER, 
	"CHARACTER_TYPE" NUMBER, 
	"TEMPLATE_ID" NUMBER, 
	"ENABLED" CHAR(1 BYTE) DEFAULT 'Y'
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."SWG_CHARACTERS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table TANGIBLE_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."TANGIBLE_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"MAX_HIT_POINTS" NUMBER(*,0), 
	"OWNER_ID" NUMBER(*,0), 
	"VISIBLE" CHAR(1 BYTE), 
	"APPEARANCE_DATA" VARCHAR2(2000 BYTE), 
	"INTEREST_RADIUS" NUMBER(*,0), 
	"PVP_TYPE" NUMBER(*,0), 
	"PVP_FACTION" NUMBER(*,0), 
	"DAMAGE_TAKEN" NUMBER(*,0), 
	"CUSTOM_APPEARANCE" VARCHAR2(2000 BYTE), 
	"COUNT" NUMBER(*,0), 
	"CONDITION" NUMBER(*,0), 
	"CREATOR_ID" NUMBER(20,0), 
	"SOURCE_DRAFT_SCHEMATIC" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."TANGIBLE_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table TEMP_CHARACTERS
--------------------------------------------------------

  CREATE TABLE "SWG"."TEMP_CHARACTERS" 
   (	"TRANSACTION_TYPE" NUMBER, 
	"STATION_ID" NUMBER, 
	"CLUSTER_NAME" VARCHAR2(120 BYTE), 
	"CHARACTER_NAME" VARCHAR2(30 BYTE), 
	"OBJECT_ID" NUMBER, 
	"TEMPLATE_NAME" VARCHAR2(120 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."TEMP_CHARACTERS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table TEMP_FREE_OBJECT_IDS
--------------------------------------------------------

  CREATE GLOBAL TEMPORARY TABLE "SWG"."TEMP_FREE_OBJECT_IDS" 
   (	"START_ID" NUMBER(*,0), 
	"END_ID" NUMBER(*,0)
   ) ON COMMIT DELETE ROWS ;
  GRANT SELECT ON "SWG"."TEMP_FREE_OBJECT_IDS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table TOKEN_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."TOKEN_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"REFERENCE" NUMBER(20,0), 
	"TARGET_SERVER_TEMPLATE_NAME" VARCHAR2(500 BYTE), 
	"TARGET_SHARED_TEMPLATE_NAME" VARCHAR2(500 BYTE), 
	"WAYPOINT" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."TOKEN_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table UNIVERSE_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."UNIVERSE_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."UNIVERSE_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table VEHICLE_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."VEHICLE_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"BOGUS" NUMBER(*,0)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."VEHICLE_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table VERSION_NUMBER
--------------------------------------------------------

  CREATE TABLE "SWG"."VERSION_NUMBER" 
   (	"VERSION_NUMBER" NUMBER(*,0), 
	"MIN_VERSION_NUMBER" NUMBER(*,0), 
	"GOLDDATA" VARCHAR2(100 BYTE), 
	"BRANCH_NAME" VARCHAR2(30 BYTE)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."VERSION_NUMBER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table WAYPOINTS
--------------------------------------------------------

  CREATE TABLE "SWG"."WAYPOINTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"WAYPOINT_ID" NUMBER(20,0), 
	"APPEARANCE_NAME_CRC" NUMBER(*,0), 
	"LOCATION_X" FLOAT(126), 
	"LOCATION_Y" FLOAT(126), 
	"LOCATION_Z" FLOAT(126), 
	"LOCATION_CELL" NUMBER(20,0), 
	"LOCATION_SCENE" NUMBER(*,0), 
	"NAME" VARCHAR2(512 BYTE), 
	"COLOR" NUMBER(*,0), 
	"ACTIVE" CHAR(1 BYTE)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."WAYPOINTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Table WEAPON_OBJECTS
--------------------------------------------------------

  CREATE TABLE "SWG"."WEAPON_OBJECTS" 
   (	"OBJECT_ID" NUMBER(20,0), 
	"MIN_DAMAGE" NUMBER(*,0), 
	"MAX_DAMAGE" NUMBER(*,0), 
	"DAMAGE_TYPE" NUMBER(*,0), 
	"ELEMENTAL_TYPE" NUMBER(*,0), 
	"ELEMENTAL_VALUE" NUMBER(*,0), 
	"ATTACK_SPEED" FLOAT(126), 
	"WOUND_CHANCE" FLOAT(126), 
	"ACCURACY" NUMBER(*,0), 
	"ATTACK_COST" NUMBER(*,0), 
	"DAMAGE_RADIUS" FLOAT(126), 
	"MIN_RANGE" FLOAT(126), 
	"MAX_RANGE" FLOAT(126)
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
  GRANT SELECT ON "SWG"."WEAPON_OBJECTS" TO PUBLIC;
--------------------------------------------------------
--  DDL for View CHARACTER_VIEW
--------------------------------------------------------

  CREATE OR REPLACE FORCE VIEW "SWG"."CHARACTER_VIEW" ("STATION_ID", "CHARACTER_OBJECT", "OBJECT_TEMPLATE_ID", "SCENE_ID", "OBJECT_NAME", "CONTAINER", "X", "Y", "Z") AS 
  select p.station_id, p.character_object, o.object_template_id, o.scene_id, o.object_name,
(select object_id from objects where contained_by=0 start with object_id=character_object connect by prior contained_by=object_id) container,
(select x from objects where contained_by=0 start with object_id=character_object connect by prior contained_by=object_id) x,
(select y from objects where contained_by=0 start with object_id=character_object connect by prior contained_by=object_id) y,
(select z from objects where contained_by=0 start with object_id=character_object connect by prior contained_by=object_id) z
from players p, objects o
where p.character_object = o.object_id
  and o.deleted = 0;
--------------------------------------------------------
--  DDL for View OBJECTS_VIEW
--------------------------------------------------------

  CREATE OR REPLACE FORCE VIEW "SWG"."OBJECTS_VIEW" ("OBJECT_ID", "X", "Y", "Z", "QUATERNION_W", "QUATERNION_X", "QUATERNION_Y", "QUATERNION_Z", "NODE_X", "NODE_Y", "NODE_Z", "TYPE_ID", "SCENE_ID", "CONTROLLER_TYPE", "DELETED", "OBJECT_NAME", "VOLUME", "CONTAINED_BY", "SLOT_ARRANGEMENT", "PLAYER_CONTROLLED", "CACHE_VERSION", "LOAD_CONTENTS", "CASH_BALANCE", "BANK_BALANCE", "COMPLEXITY", "NAME_STRING_TABLE", "NAME_STRING_TEXT", "OBJECT_TEMPLATE_ID", "STATIC_ITEM_NAME", "STATIC_ITEM_VERSION", "CONVERSION_ID", "DELETED_DATE", "LOAD_WITH", "OBJVAR_0_NAME", "OBJVAR_0_TYPE", "OBJVAR_0_VALUE", "OBJVAR_1_NAME", "OBJVAR_1_TYPE", "OBJVAR_1_VALUE", "OBJVAR_2_NAME", "OBJVAR_2_TYPE", "OBJVAR_2_VALUE", "OBJVAR_3_NAME", "OBJVAR_3_TYPE", "OBJVAR_3_VALUE", "OBJVAR_4_NAME", "OBJVAR_4_TYPE", "OBJVAR_4_VALUE", "OBJVAR_5_NAME", "OBJVAR_5_TYPE", "OBJVAR_5_VALUE", "OBJVAR_6_NAME", "OBJVAR_6_TYPE", "OBJVAR_6_VALUE", "OBJVAR_7_NAME", "OBJVAR_7_TYPE", "OBJVAR_7_VALUE", "OBJVAR_8_NAME", "OBJVAR_8_TYPE", "OBJVAR_8_VALUE", "OBJVAR_9_NAME", "OBJVAR_9_TYPE", "OBJVAR_9_VALUE", "OBJVAR_10_NAME", "OBJVAR_10_TYPE", "OBJVAR_10_VALUE", "OBJVAR_11_NAME", "OBJVAR_11_TYPE", "OBJVAR_11_VALUE", "OBJVAR_12_NAME", "OBJVAR_12_TYPE", "OBJVAR_12_VALUE", "OBJVAR_13_NAME", "OBJVAR_13_TYPE", "OBJVAR_13_VALUE", "OBJVAR_14_NAME", "OBJVAR_14_TYPE", "OBJVAR_14_VALUE", "OBJVAR_15_NAME", "OBJVAR_15_TYPE", "OBJVAR_15_VALUE", "OBJVAR_16_NAME", "OBJVAR_16_TYPE", "OBJVAR_16_VALUE", "OBJVAR_17_NAME", "OBJVAR_17_TYPE", "OBJVAR_17_VALUE", "OBJVAR_18_NAME", "OBJVAR_18_TYPE", "OBJVAR_18_VALUE", "OBJVAR_19_NAME", "OBJVAR_19_TYPE", "OBJVAR_19_VALUE", "SCRIPT_LIST", "OBJECT_TEMPLATE") AS 
  select o."OBJECT_ID",o."X",o."Y",o."Z",o."QUATERNION_W",o."QUATERNION_X",o."QUATERNION_Y",o."QUATERNION_Z",o."NODE_X",o."NODE_Y",o."NODE_Z",o."TYPE_ID",o."SCENE_ID",o."CONTROLLER_TYPE",o."DELETED",o."OBJECT_NAME",o."VOLUME",o."CONTAINED_BY",o."SLOT_ARRANGEMENT",o."PLAYER_CONTROLLED",o."CACHE_VERSION",o."LOAD_CONTENTS",o."CASH_BALANCE",o."BANK_BALANCE",o."COMPLEXITY",o."NAME_STRING_TABLE",o."NAME_STRING_TEXT",o."OBJECT_TEMPLATE_ID",o."STATIC_ITEM_NAME",o."STATIC_ITEM_VERSION",o."CONVERSION_ID",o."DELETED_DATE",o."LOAD_WITH",o."OBJVAR_0_NAME",o."OBJVAR_0_TYPE",o."OBJVAR_0_VALUE",o."OBJVAR_1_NAME",o."OBJVAR_1_TYPE",o."OBJVAR_1_VALUE",o."OBJVAR_2_NAME",o."OBJVAR_2_TYPE",o."OBJVAR_2_VALUE",o."OBJVAR_3_NAME",o."OBJVAR_3_TYPE",o."OBJVAR_3_VALUE",o."OBJVAR_4_NAME",o."OBJVAR_4_TYPE",o."OBJVAR_4_VALUE",o."OBJVAR_5_NAME",o."OBJVAR_5_TYPE",o."OBJVAR_5_VALUE",o."OBJVAR_6_NAME",o."OBJVAR_6_TYPE",o."OBJVAR_6_VALUE",o."OBJVAR_7_NAME",o."OBJVAR_7_TYPE",o."OBJVAR_7_VALUE",o."OBJVAR_8_NAME",o."OBJVAR_8_TYPE",o."OBJVAR_8_VALUE",o."OBJVAR_9_NAME",o."OBJVAR_9_TYPE",o."OBJVAR_9_VALUE",o."OBJVAR_10_NAME",o."OBJVAR_10_TYPE",o."OBJVAR_10_VALUE",o."OBJVAR_11_NAME",o."OBJVAR_11_TYPE",o."OBJVAR_11_VALUE",o."OBJVAR_12_NAME",o."OBJVAR_12_TYPE",o."OBJVAR_12_VALUE",o."OBJVAR_13_NAME",o."OBJVAR_13_TYPE",o."OBJVAR_13_VALUE",o."OBJVAR_14_NAME",o."OBJVAR_14_TYPE",o."OBJVAR_14_VALUE",o."OBJVAR_15_NAME",o."OBJVAR_15_TYPE",o."OBJVAR_15_VALUE",o."OBJVAR_16_NAME",o."OBJVAR_16_TYPE",o."OBJVAR_16_VALUE",o."OBJVAR_17_NAME",o."OBJVAR_17_TYPE",o."OBJVAR_17_VALUE",o."OBJVAR_18_NAME",o."OBJVAR_18_TYPE",o."OBJVAR_18_VALUE",o."OBJVAR_19_NAME",o."OBJVAR_19_TYPE",o."OBJVAR_19_VALUE",o."SCRIPT_LIST", t.name object_template
from objects o, object_templates t
where o.object_template_id = t.id;
--------------------------------------------------------
--  DDL for View OBJECT_VARIABLES_VIEW
--------------------------------------------------------

  CREATE OR REPLACE FORCE VIEW "SWG"."OBJECT_VARIABLES_VIEW" ("OBJECT_ID", "NAME", "TYPE", "VALUE", "PACKED") AS 
  select v.object_id, n.name, v.type, v.value, -1 packed
from object_variables v, object_variable_names n
where v.name_id = n.id
and v.detached = 0
union all
select o.object_id, o.objvar_0_name, o.objvar_0_type, o.objvar_0_value, 0
from objects o
where o.objvar_0_type >= 0
union all
select o.object_id, o.objvar_1_name, o.objvar_1_type, o.objvar_1_value, 1
from objects o
where o.objvar_1_type >= 0
union all
select o.object_id, o.objvar_2_name, o.objvar_2_type, o.objvar_2_value, 2
from objects o
where o.objvar_2_type >= 0
union all
select o.object_id, o.objvar_3_name, o.objvar_3_type, o.objvar_3_value, 3
from objects o
where o.objvar_3_type >= 0
union all
select o.object_id, o.objvar_4_name, o.objvar_4_type, o.objvar_4_value, 4
from objects o
where o.objvar_4_type >= 0
union all
select o.object_id, o.objvar_5_name, o.objvar_5_type, o.objvar_5_value, 5
from objects o
where o.objvar_5_type >= 0
union all
select o.object_id, o.objvar_6_name, o.objvar_6_type, o.objvar_6_value, 6
from objects o
where o.objvar_6_type >= 0
union all
select o.object_id, o.objvar_7_name, o.objvar_7_type, o.objvar_7_value, 7
from objects o
where o.objvar_7_type >= 0
union all
select o.object_id, o.objvar_8_name, o.objvar_8_type, o.objvar_8_value, 8
from objects o
where o.objvar_8_type >= 0
union all
select o.object_id, o.objvar_9_name, o.objvar_9_type, o.objvar_9_value, 9
from objects o
where o.objvar_9_type >= 0
union all
select o.object_id, o.objvar_10_name, o.objvar_10_type, o.objvar_10_value, 10
from objects o
where o.objvar_10_type >= 0
union all
select o.object_id, o.objvar_11_name, o.objvar_11_type, o.objvar_11_value, 11
from objects o
where o.objvar_11_type >= 0
union all
select o.object_id, o.objvar_12_name, o.objvar_12_type, o.objvar_12_value, 12
from objects o
where o.objvar_12_type >= 0
union all
select o.object_id, o.objvar_13_name, o.objvar_13_type, o.objvar_13_value, 13
from objects o
where o.objvar_13_type >= 0
union all
select o.object_id, o.objvar_14_name, o.objvar_14_type, o.objvar_14_value, 14
from objects o
where o.objvar_14_type >= 0
union all
select o.object_id, o.objvar_15_name, o.objvar_15_type, o.objvar_15_value, 15
from objects o
where o.objvar_15_type >= 0
union all
select o.object_id, o.objvar_16_name, o.objvar_16_type, o.objvar_16_value, 16
from objects o
where o.objvar_16_type >= 0
union all
select o.object_id, o.objvar_17_name, o.objvar_17_type, o.objvar_17_value, 17
from objects o
where o.objvar_17_type >= 0
union all
select o.object_id, o.objvar_18_name, o.objvar_18_type, o.objvar_18_value, 18
from objects o
where o.objvar_18_type >= 0
union all
select o.object_id, o.objvar_19_name, o.objvar_19_type, o.objvar_19_value, 19
from objects o
where o.objvar_19_type >= 0;
--------------------------------------------------------
--  DDL for Index PK_WAYPOINTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_WAYPOINTS" ON "SWG"."WAYPOINTS" ("WAYPOINT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_DELETE_REASONS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_DELETE_REASONS" ON "SWG"."DELETE_REASONS" ("REASON_CODE") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_BIOGRAPHIES
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_BIOGRAPHIES" ON "SWG"."BIOGRAPHIES" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_PLAYER_QUEST_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_PLAYER_QUEST_OBJECTS" ON "SWG"."PLAYER_QUEST_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_WEAPON_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_WEAPON_OBJECTS" ON "SWG"."WEAPON_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_TANGIBLE_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_TANGIBLE_OBJECTS" ON "SWG"."TANGIBLE_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_MARKET_AUCTION_ATTRIBUTES
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_MARKET_AUCTION_ATTRIBUTES" ON "SWG"."MARKET_AUCTION_ATTRIBUTES" ("ITEM_ID", "ATTRIBUTE_NAME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_ACCOUNT_REWARD_EVENTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_ACCOUNT_REWARD_EVENTS" ON "SWG"."ACCOUNT_REWARD_EVENTS" ("STATION_ID", "EVENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_PROPERTY_LISTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_PROPERTY_LISTS" ON "SWG"."PROPERTY_LISTS" ("OBJECT_ID", "LIST_ID", "VALUE") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index OBJECT_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."OBJECT_IDX" ON "SWG"."MESSAGES" ("TARGET") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_MANF_SCHEMATIC_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_MANF_SCHEMATIC_OBJECTS" ON "SWG"."MANF_SCHEMATIC_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_CLOCK
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_CLOCK" ON "SWG"."CLOCK" ("LAST_SAVE_TIME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_OBJECT_VARIABLES
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_OBJECT_VARIABLES" ON "SWG"."OBJECT_VARIABLES" ("OBJECT_ID", "NAME_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_ACCOUNT_REWARD_ITEMS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_ACCOUNT_REWARD_ITEMS" ON "SWG"."ACCOUNT_REWARD_ITEMS" ("STATION_ID", "ITEM_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index OBJECT_VARIABLE_NAME_INDEX
--------------------------------------------------------

  CREATE INDEX "SWG"."OBJECT_VARIABLE_NAME_INDEX" ON "SWG"."OBJECT_VARIABLE_NAMES" ("NAME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_RERAISE_LIMITS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_RERAISE_LIMITS" ON "SWG"."ERRORLOG_RERAISE_LIMITS" ("PACKAGE", "PROCEDURE") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_LOADBEACON_SERVER_MAP
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_LOADBEACON_SERVER_MAP" ON "SWG"."LOADBEACON_SERVER_MAP" ("OBJECT_TEMPLATE") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index CONTAINER_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."CONTAINER_IDX" ON "SWG"."OBJECTS" ("CONTAINED_BY") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_FACTORY_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_FACTORY_OBJECTS" ON "SWG"."FACTORY_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_ACCOUNTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_ACCOUNTS" ON "SWG"."ACCOUNTS" ("STATION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index ACCOUNT_MAP_INDEX1
--------------------------------------------------------

  CREATE INDEX "SWG"."ACCOUNT_MAP_INDEX1" ON "SWG"."ACCOUNT_MAP" ("CHILD_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index AUCTION_LOCATION_NAME_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."AUCTION_LOCATION_NAME_IDX" ON "SWG"."AUCTION_LOCATIONS" ("LOCATION_NAME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_PLAYER_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_PLAYER_OBJECTS" ON "SWG"."PLAYER_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index ACCOUNT_INFO_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."ACCOUNT_INFO_PK" ON "SWG"."ACCOUNT_INFO" ("STATION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_SWG_CHARACTER
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_SWG_CHARACTER" ON "SWG"."SWG_CHARACTERS" ("STATION_ID", "CLUSTER_ID", "CHARACTER_NAME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_FREE_OBJECT_IDS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_FREE_OBJECT_IDS" ON "SWG"."FREE_OBJECT_IDS" ("START_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PLAYERS_STATION_ID_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."PLAYERS_STATION_ID_IDX" ON "SWG"."PLAYERS" ("STATION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_MARKET_AUCTIONS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_MARKET_AUCTIONS" ON "SWG"."MARKET_AUCTIONS" ("ITEM_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_ERRORLOG
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_ERRORLOG" ON "SWG"."ERRORLOG" ("ERROR_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_MANUFACTURE_INST_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_MANUFACTURE_INST_OBJECTS" ON "SWG"."MANUFACTURE_INST_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_PLAYERS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_PLAYERS" ON "SWG"."PLAYERS" ("CHARACTER_OBJECT") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_LOCATION_LISTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_LOCATION_LISTS" ON "SWG"."LOCATION_LISTS" ("OBJECT_ID", "LIST_ID", "SEQUENCE_NUMBER") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_RESOURCE_TYPES
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_RESOURCE_TYPES" ON "SWG"."RESOURCE_TYPES" ("RESOURCE_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index OBJECT_TEMPLATES_NAME_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."OBJECT_TEMPLATES_NAME_IDX" ON "SWG"."OBJECT_TEMPLATES" ("NAME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index CHUNK_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."CHUNK_IDX" ON "SWG"."OBJECTS" ("NODE_X", "NODE_Z", "SCENE_ID", "DELETED", "CONTAINED_BY", "PLAYER_CONTROLLED", "LOAD_CONTENTS") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index OWNER_ID_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."OWNER_ID_IDX" ON "SWG"."TANGIBLE_OBJECTS" ("OWNER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_SCRUNCHER
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_SCRUNCHER" ON "SWG"."SCRUNCHER" ("OLD_OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_BATTLEFIELD_PARTICIPANTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_BATTLEFIELD_PARTICIPANTS" ON "SWG"."BATTLEFIELD_PARTICIPANTS" ("REGION_OBJECT_ID", "CHARACTER_OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_AUCTION_LOCATIONS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_AUCTION_LOCATIONS" ON "SWG"."AUCTION_LOCATIONS" ("LOCATION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_BOUNTY_HUNTER_TARGETS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_BOUNTY_HUNTER_TARGETS" ON "SWG"."BOUNTY_HUNTER_TARGETS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_INTANGIBLE_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_INTANGIBLE_OBJECTS" ON "SWG"."INTANGIBLE_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_CLUSTER_LIST
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_CLUSTER_LIST" ON "SWG"."CLUSTER_LIST" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PURGE_PHASES_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PURGE_PHASES_PK" ON "SWG"."PURGE_PHASES" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index REGION_NAME_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."REGION_NAME_IDX" ON "SWG"."BATTLEFIELD_MARKER_OBJECTS" ("REGION_NAME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_EXPERIENCE_POINTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_EXPERIENCE_POINTS" ON "SWG"."EXPERIENCE_POINTS" ("OBJECT_ID", "EXPERIENCE_TYPE") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index ACCOUNT_EXTRACT_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."ACCOUNT_EXTRACT_PK" ON "SWG"."ACCOUNT_EXTRACT" ("USER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_OBJECTS" ON "SWG"."OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_MARKET_AUCTION_BIDS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_MARKET_AUCTION_BIDS" ON "SWG"."MARKET_AUCTION_BIDS" ("ITEM_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index DELETED_OBJECT_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."DELETED_OBJECT_IDX" ON "SWG"."OBJECTS" ("DELETED_DATE") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_MISSION_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_MISSION_OBJECTS" ON "SWG"."MISSION_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index TIMESTAMP_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."TIMESTAMP_IDX" ON "SWG"."ERRORLOG" ("TIMESTAMP") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_PUBLISH_PLAYER_FIXUP
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_PUBLISH_PLAYER_FIXUP" ON "SWG"."PUBLISH_PLAYER_FIXUP" ("PLAYER_OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_ARMOR
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_ARMOR" ON "SWG"."ARMOR" ("OBJECT_ID", "LAYER") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_SHIP_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_SHIP_OBJECTS" ON "SWG"."SHIP_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index WAYPOINT_LOAD_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."WAYPOINT_LOAD_IDX" ON "SWG"."WAYPOINTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index ACCOUNT_MAP_INDEX2
--------------------------------------------------------

  CREATE INDEX "SWG"."ACCOUNT_MAP_INDEX2" ON "SWG"."ACCOUNT_MAP" ("CHILD_ID", "PARENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_DEFAULT_CHARACTER_SLOTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_DEFAULT_CHARACTER_SLOTS" ON "SWG"."DEFAULT_CHARACTER_SLOTS" ("CHARACTER_TYPE_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_MANF_SCHEMATIC_ATTRIBUTES
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_MANF_SCHEMATIC_ATTRIBUTES" ON "SWG"."MANF_SCHEMATIC_ATTRIBUTES" ("OBJECT_ID", "ATTRIBUTE_TYPE") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_HARVESTER_INST_OBJECTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_HARVESTER_INST_OBJECTS" ON "SWG"."HARVESTER_INSTALLATION_OBJECTS" ("OBJECT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_CHARACTER_PROFILE
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_CHARACTER_PROFILE" ON "SWG"."CHARACTER_PROFILE" ("CLUSTER_NAME", "CHARACTER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index LOAD_WITH_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."LOAD_WITH_IDX" ON "SWG"."OBJECTS" ("LOAD_WITH") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_FEATURE_ID_TRANSACTIONS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_FEATURE_ID_TRANSACTIONS" ON "SWG"."FEATURE_ID_TRANSACTIONS" ("STATION_ID", "CLUSTER_ID", "CHARACTER_ID", "ITEM_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_CHARACTER_TYPES
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_CHARACTER_TYPES" ON "SWG"."CHARACTER_TYPES" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index FK_ERRORLOG_VALUES_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."FK_ERRORLOG_VALUES_IDX" ON "SWG"."ERRORLOG_VALUES" ("ERROR_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_OBJECT_VARIABLE_NAMES
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_OBJECT_VARIABLE_NAMES" ON "SWG"."OBJECT_VARIABLE_NAMES" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_OBJECT_TEMPLATES
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_OBJECT_TEMPLATES" ON "SWG"."OBJECT_TEMPLATES" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PK_EXTRA_CHARACTER_SLOTS
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PK_EXTRA_CHARACTER_SLOTS" ON "SWG"."EXTRA_CHARACTER_SLOTS" ("STATION_ID", "CLUSTER_ID", "CHARACTER_TYPE_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index PURGE_ACCOUNTS_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."PURGE_ACCOUNTS_PK" ON "SWG"."PURGE_ACCOUNTS" ("STATION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index STATUSES_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "SWG"."STATUSES_PK" ON "SWG"."STATUSES" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  DDL for Index MARKET_AUCTION_LOCATION_IDX
--------------------------------------------------------

  CREATE INDEX "SWG"."MARKET_AUCTION_LOCATION_IDX" ON "SWG"."MARKET_AUCTIONS" ("LOCATION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG" ;
--------------------------------------------------------
--  Constraints for Table PURGE_PHASES
--------------------------------------------------------

  ALTER TABLE "SWG"."PURGE_PHASES" ADD CONSTRAINT "PURGE_PHASES_PK" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ERRORLOG_LEVEL
--------------------------------------------------------

  ALTER TABLE "SWG"."ERRORLOG_LEVEL" MODIFY ("LEVELID" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table HARVESTER_INSTALLATION_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."HARVESTER_INSTALLATION_OBJECTS" ADD CONSTRAINT "PK_HARVESTER_INST_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table SCRUNCHER
--------------------------------------------------------

  ALTER TABLE "SWG"."SCRUNCHER" ADD CONSTRAINT "PK_SCRUNCHER" PRIMARY KEY ("OLD_OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ERRORLOG_LEVEL_DESC
--------------------------------------------------------

  ALTER TABLE "SWG"."ERRORLOG_LEVEL_DESC" MODIFY ("LEVELID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG_LEVEL_DESC" MODIFY ("DESCRIP" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table VEHICLE_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."VEHICLE_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table PROPERTY_LISTS
--------------------------------------------------------

  ALTER TABLE "SWG"."PROPERTY_LISTS" ADD CONSTRAINT "PK_PROPERTY_LISTS" PRIMARY KEY ("OBJECT_ID", "LIST_ID", "VALUE")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table LOCATION_LISTS
--------------------------------------------------------

  ALTER TABLE "SWG"."LOCATION_LISTS" ADD CONSTRAINT "PK_LOCATION_LISTS" PRIMARY KEY ("OBJECT_ID", "LIST_ID", "SEQUENCE_NUMBER")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table WEAPON_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."WEAPON_OBJECTS" ADD CONSTRAINT "PK_WEAPON_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table OBJECT_VARIABLE_NAMES
--------------------------------------------------------

  ALTER TABLE "SWG"."OBJECT_VARIABLE_NAMES" ADD CONSTRAINT "PK_OBJECT_VARIABLE_NAMES" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ERRORLOG
--------------------------------------------------------

  ALTER TABLE "SWG"."ERRORLOG" ADD CONSTRAINT "PK_ERRORLOG" PRIMARY KEY ("ERROR_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."ERRORLOG" MODIFY ("ERROR_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG" MODIFY ("TIMESTAMP" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG" MODIFY ("ORA_ERRNO" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG" MODIFY ("ORA_ERRMSG" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG" MODIFY ("SCHEMA_NAME" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG" MODIFY ("MODULE_NAME" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table ACCOUNT_MAP
--------------------------------------------------------

  ALTER TABLE "SWG"."ACCOUNT_MAP" ADD CONSTRAINT "ACCOUNT_MAP_UK1" UNIQUE ("CHILD_ID", "PARENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."ACCOUNT_MAP" ADD CONSTRAINT "ACCOUNT_MAP_UK2" UNIQUE ("CHILD_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."ACCOUNT_MAP" MODIFY ("PARENT_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ACCOUNT_MAP" MODIFY ("CHILD_ID" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table WAYPOINTS
--------------------------------------------------------

  ALTER TABLE "SWG"."WAYPOINTS" ADD CONSTRAINT "PK_WAYPOINTS" PRIMARY KEY ("WAYPOINT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table PLAYER_QUEST_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."PLAYER_QUEST_OBJECTS" ADD CONSTRAINT "PK_PLAYER_QUEST_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table LOADBEACON_SERVER_MAP
--------------------------------------------------------

  ALTER TABLE "SWG"."LOADBEACON_SERVER_MAP" ADD CONSTRAINT "PK_LOADBEACON_SERVER_MAP" PRIMARY KEY ("OBJECT_TEMPLATE")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table MESSAGES
--------------------------------------------------------

  ALTER TABLE "SWG"."MESSAGES" ADD PRIMARY KEY ("MESSAGE_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ACCOUNT_REWARD_EVENTS
--------------------------------------------------------

  ALTER TABLE "SWG"."ACCOUNT_REWARD_EVENTS" ADD CONSTRAINT "PK_ACCOUNT_REWARD_EVENTS" PRIMARY KEY ("STATION_ID", "EVENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table GUILD_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."GUILD_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table VERSION_NUMBER
--------------------------------------------------------

  ALTER TABLE "SWG"."VERSION_NUMBER" ADD PRIMARY KEY ("VERSION_NUMBER")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table CELL_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."CELL_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table PLANET_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."PLANET_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table INSTALLATION_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."INSTALLATION_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ACCOUNT_INFO
--------------------------------------------------------

  ALTER TABLE "SWG"."ACCOUNT_INFO" ADD CONSTRAINT "ACCOUNT_INFO_PK" PRIMARY KEY ("STATION_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."ACCOUNT_INFO" MODIFY ("STATION_ID" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table CLOCK
--------------------------------------------------------

  ALTER TABLE "SWG"."CLOCK" ADD CONSTRAINT "PK_CLOCK" PRIMARY KEY ("LAST_SAVE_TIME")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ACCOUNT_EXTRACT
--------------------------------------------------------

  ALTER TABLE "SWG"."ACCOUNT_EXTRACT" ADD CONSTRAINT "ACCOUNT_EXTRACT_PK" PRIMARY KEY ("USER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table AUCTION_LOCATIONS
--------------------------------------------------------

  ALTER TABLE "SWG"."AUCTION_LOCATIONS" ADD CONSTRAINT "PK_AUCTION_LOCATIONS" PRIMARY KEY ("LOCATION_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."AUCTION_LOCATIONS" MODIFY ("EMPTY_DATE" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUCTION_LOCATIONS" MODIFY ("LAST_ACCESS_DATE" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUCTION_LOCATIONS" MODIFY ("INACTIVE_DATE" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUCTION_LOCATIONS" MODIFY ("STATUS" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUCTION_LOCATIONS" MODIFY ("ENTRANCE_CHARGE" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table CITY_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."CITY_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table TOKEN_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."TOKEN_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table TANGIBLE_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."TANGIBLE_OBJECTS" ADD CONSTRAINT "PK_TANGIBLE_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ERRORLOG_RERAISE_LIMITS
--------------------------------------------------------

  ALTER TABLE "SWG"."ERRORLOG_RERAISE_LIMITS" ADD CONSTRAINT "PK_RERAISE_LIMITS" PRIMARY KEY ("PACKAGE", "PROCEDURE")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."ERRORLOG_RERAISE_LIMITS" MODIFY ("PACKAGE" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG_RERAISE_LIMITS" MODIFY ("PROCEDURE" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG_RERAISE_LIMITS" MODIFY ("ERRORLIMIT" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG_RERAISE_LIMITS" MODIFY ("ERRORCOUNT" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG_RERAISE_LIMITS" MODIFY ("UNLIMITED_FLAG" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table INTANGIBLE_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."INTANGIBLE_OBJECTS" ADD CONSTRAINT "PK_INTANGIBLE_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table STATIC_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."STATIC_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table EXTRA_CHARACTER_SLOTS
--------------------------------------------------------

  ALTER TABLE "SWG"."EXTRA_CHARACTER_SLOTS" ADD CONSTRAINT "PK_EXTRA_CHARACTER_SLOTS" PRIMARY KEY ("STATION_ID", "CLUSTER_ID", "CHARACTER_TYPE_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."EXTRA_CHARACTER_SLOTS" MODIFY ("STATION_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."EXTRA_CHARACTER_SLOTS" MODIFY ("CLUSTER_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."EXTRA_CHARACTER_SLOTS" MODIFY ("CHARACTER_TYPE_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."EXTRA_CHARACTER_SLOTS" MODIFY ("NUM_EXTRA_SLOTS" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table ACCOUNT_REWARD_ITEMS
--------------------------------------------------------

  ALTER TABLE "SWG"."ACCOUNT_REWARD_ITEMS" ADD CONSTRAINT "PK_ACCOUNT_REWARD_ITEMS" PRIMARY KEY ("STATION_ID", "ITEM_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table BATTLEFIELD_PARTICIPANTS
--------------------------------------------------------

  ALTER TABLE "SWG"."BATTLEFIELD_PARTICIPANTS" ADD CONSTRAINT "PK_BATTLEFIELD_PARTICIPANTS" PRIMARY KEY ("REGION_OBJECT_ID", "CHARACTER_OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table FREE_OBJECT_IDS
--------------------------------------------------------

  ALTER TABLE "SWG"."FREE_OBJECT_IDS" ADD CONSTRAINT "PK_FREE_OBJECT_IDS" PRIMARY KEY ("START_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table EXPERIENCE_POINTS
--------------------------------------------------------

  ALTER TABLE "SWG"."EXPERIENCE_POINTS" ADD CONSTRAINT "PK_EXPERIENCE_POINTS" PRIMARY KEY ("OBJECT_ID", "EXPERIENCE_TYPE")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table SCRIPTS
--------------------------------------------------------

  ALTER TABLE "SWG"."SCRIPTS" ADD PRIMARY KEY ("OBJECT_ID", "SEQUENCE_NO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table UNIVERSE_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."UNIVERSE_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table CHARACTER_TYPES
--------------------------------------------------------

  ALTER TABLE "SWG"."CHARACTER_TYPES" ADD CONSTRAINT "PK_CHARACTER_TYPES" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."CHARACTER_TYPES" MODIFY ("ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."CHARACTER_TYPES" MODIFY ("DESCRIPTION" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table SHIP_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."SHIP_OBJECTS" ADD CONSTRAINT "PK_SHIP_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table BIOGRAPHIES
--------------------------------------------------------

  ALTER TABLE "SWG"."BIOGRAPHIES" ADD CONSTRAINT "PK_BIOGRAPHIES" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table RESOURCE_CONTAINER_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."RESOURCE_CONTAINER_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table MANF_SCHEMATIC_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."MANF_SCHEMATIC_OBJECTS" ADD CONSTRAINT "PK_MANF_SCHEMATIC_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."OBJECTS" ADD CONSTRAINT "PK_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table ERRORLOG_VALUES
--------------------------------------------------------

  ALTER TABLE "SWG"."ERRORLOG_VALUES" MODIFY ("ERROR_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG_VALUES" MODIFY ("ELEMENT_OWNER" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG_VALUES" MODIFY ("ELEMENT_NAME" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."ERRORLOG_VALUES" MODIFY ("ELEMENT_TYPE" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table RESOURCE_TYPES
--------------------------------------------------------

  ALTER TABLE "SWG"."RESOURCE_TYPES" ADD CONSTRAINT "PK_RESOURCE_TYPES" PRIMARY KEY ("RESOURCE_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table DEFAULT_CHARACTER_SLOTS
--------------------------------------------------------

  ALTER TABLE "SWG"."DEFAULT_CHARACTER_SLOTS" ADD CONSTRAINT "PK_DEFAULT_CHARACTER_SLOTS" PRIMARY KEY ("CHARACTER_TYPE_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."DEFAULT_CHARACTER_SLOTS" MODIFY ("CHARACTER_TYPE_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."DEFAULT_CHARACTER_SLOTS" MODIFY ("NUM_SLOTS" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table BATTLEFIELD_MARKER_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."BATTLEFIELD_MARKER_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table BUILDING_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."BUILDING_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table AUTOMATED_QUERIES
--------------------------------------------------------

  ALTER TABLE "SWG"."AUTOMATED_QUERIES" MODIFY ("ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUTOMATED_QUERIES" MODIFY ("CREATETIME" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUTOMATED_QUERIES" MODIFY ("STATUS" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUTOMATED_QUERIES" MODIFY ("TYPE" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUTOMATED_QUERIES" MODIFY ("RUN_SERIAL" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."AUTOMATED_QUERIES" MODIFY ("QUERY_TEXT" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table FEATURE_ID_TRANSACTIONS
--------------------------------------------------------

  ALTER TABLE "SWG"."FEATURE_ID_TRANSACTIONS" ADD CONSTRAINT "PK_FEATURE_ID_TRANSACTIONS" PRIMARY KEY ("STATION_ID", "CLUSTER_ID", "CHARACTER_ID", "ITEM_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table PLAYER_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."PLAYER_OBJECTS" ADD CONSTRAINT "PK_PLAYER_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table DEFAULT_CHAR_LIMITS
--------------------------------------------------------

  ALTER TABLE "SWG"."DEFAULT_CHAR_LIMITS" MODIFY ("ACCOUNT_LIMIT" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."DEFAULT_CHAR_LIMITS" MODIFY ("CLUSTER_LIMIT" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table BOUNTY_HUNTER_TARGETS
--------------------------------------------------------

  ALTER TABLE "SWG"."BOUNTY_HUNTER_TARGETS" ADD CONSTRAINT "PK_BOUNTY_HUNTER_TARGETS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."BOUNTY_HUNTER_TARGETS" MODIFY ("OBJECT_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."BOUNTY_HUNTER_TARGETS" MODIFY ("TARGET_ID" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table SWG_CHARACTERS
--------------------------------------------------------

  ALTER TABLE "SWG"."SWG_CHARACTERS" ADD CONSTRAINT "PK_SWG_CHARACTER" PRIMARY KEY ("STATION_ID", "CLUSTER_ID", "CHARACTER_NAME")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."SWG_CHARACTERS" MODIFY ("STATION_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."SWG_CHARACTERS" MODIFY ("CLUSTER_ID" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."SWG_CHARACTERS" MODIFY ("CHARACTER_NAME" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."SWG_CHARACTERS" MODIFY ("ENABLED" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table OBJECT_VARIABLES
--------------------------------------------------------

  ALTER TABLE "SWG"."OBJECT_VARIABLES" ADD CONSTRAINT "PK_OBJECT_VARIABLES" PRIMARY KEY ("OBJECT_ID", "NAME_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table PLAYERS
--------------------------------------------------------

  ALTER TABLE "SWG"."PLAYERS" ADD CONSTRAINT "PK_PLAYERS" PRIMARY KEY ("CHARACTER_OBJECT")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table OBJECT_TEMPLATES
--------------------------------------------------------

  ALTER TABLE "SWG"."OBJECT_TEMPLATES" ADD CONSTRAINT "PK_OBJECT_TEMPLATES" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table MARKET_AUCTION_BIDS
--------------------------------------------------------

  ALTER TABLE "SWG"."MARKET_AUCTION_BIDS" ADD CONSTRAINT "PK_MARKET_AUCTION_BIDS" PRIMARY KEY ("ITEM_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table MISSION_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."MISSION_OBJECTS" ADD CONSTRAINT "PK_MISSION_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table CLUSTER_LIST
--------------------------------------------------------

  ALTER TABLE "SWG"."CLUSTER_LIST" ADD CONSTRAINT "PK_CLUSTER_LIST" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."CLUSTER_LIST" MODIFY ("GROUP_ID" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table PUBLISH_PLAYER_FIXUP
--------------------------------------------------------

  ALTER TABLE "SWG"."PUBLISH_PLAYER_FIXUP" ADD CONSTRAINT "PK_PUBLISH_PLAYER_FIXUP" PRIMARY KEY ("PLAYER_OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table MARKET_AUCTIONS
--------------------------------------------------------

  ALTER TABLE "SWG"."MARKET_AUCTIONS" ADD CONSTRAINT "PK_MARKET_AUCTIONS" PRIMARY KEY ("ITEM_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."MARKET_AUCTIONS" MODIFY ("ITEM_SIZE" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table ACCOUNTS
--------------------------------------------------------

  ALTER TABLE "SWG"."ACCOUNTS" ADD CONSTRAINT "PK_ACCOUNTS" PRIMARY KEY ("STATION_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table CHARACTER_PROFILE
--------------------------------------------------------

  ALTER TABLE "SWG"."CHARACTER_PROFILE" ADD CONSTRAINT "PK_CHARACTER_PROFILE" PRIMARY KEY ("CLUSTER_NAME", "CHARACTER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
 
  ALTER TABLE "SWG"."CHARACTER_PROFILE" MODIFY ("CLUSTER_NAME" NOT NULL ENABLE);
 
  ALTER TABLE "SWG"."CHARACTER_PROFILE" MODIFY ("CHARACTER_ID" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table ARMOR
--------------------------------------------------------

  ALTER TABLE "SWG"."ARMOR" ADD CONSTRAINT "PK_ARMOR" PRIMARY KEY ("OBJECT_ID", "LAYER")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table MANUFACTURE_INST_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."MANUFACTURE_INST_OBJECTS" ADD CONSTRAINT "PK_MANUFACTURE_INST_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table PURGE_ACCOUNTS
--------------------------------------------------------

  ALTER TABLE "SWG"."PURGE_ACCOUNTS" ADD CONSTRAINT "PURGE_ACCOUNTS_PK" PRIMARY KEY ("STATION_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table STATUSES
--------------------------------------------------------

  ALTER TABLE "SWG"."STATUSES" ADD CONSTRAINT "STATUSES_PK" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table FACTORY_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."FACTORY_OBJECTS" ADD CONSTRAINT "PK_FACTORY_OBJECTS" PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table CREATURE_OBJECTS
--------------------------------------------------------

  ALTER TABLE "SWG"."CREATURE_OBJECTS" ADD PRIMARY KEY ("OBJECT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table DELETE_REASONS
--------------------------------------------------------

  ALTER TABLE "SWG"."DELETE_REASONS" ADD CONSTRAINT "PK_DELETE_REASONS" PRIMARY KEY ("REASON_CODE")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table MARKET_AUCTION_ATTRIBUTES
--------------------------------------------------------

  ALTER TABLE "SWG"."MARKET_AUCTION_ATTRIBUTES" ADD CONSTRAINT "PK_MARKET_AUCTION_ATTRIBUTES" PRIMARY KEY ("ITEM_ID", "ATTRIBUTE_NAME")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Constraints for Table MANF_SCHEMATIC_ATTRIBUTES
--------------------------------------------------------

  ALTER TABLE "SWG"."MANF_SCHEMATIC_ATTRIBUTES" ADD CONSTRAINT "PK_MANF_SCHEMATIC_ATTRIBUTES" PRIMARY KEY ("OBJECT_ID", "ATTRIBUTE_TYPE")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING
  TABLESPACE "SWG"  ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table ERRORLOG_VALUES
--------------------------------------------------------

  ALTER TABLE "SWG"."ERRORLOG_VALUES" ADD CONSTRAINT "FK_ERRORLOG" FOREIGN KEY ("ERROR_ID")
	  REFERENCES "SWG"."ERRORLOG" ("ERROR_ID") ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table MARKET_AUCTIONS
--------------------------------------------------------

  ALTER TABLE "SWG"."MARKET_AUCTIONS" ADD CONSTRAINT "MARKET_AUCTIONS_LOCATION_ID_FK" FOREIGN KEY ("LOCATION_ID")
	  REFERENCES "SWG"."AUCTION_LOCATIONS" ("LOCATION_ID") ON DELETE CASCADE ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table MARKET_AUCTION_ATTRIBUTES
--------------------------------------------------------

  ALTER TABLE "SWG"."MARKET_AUCTION_ATTRIBUTES" ADD CONSTRAINT "MARKET_ATTRIBUTES_ITEM_ID_FK" FOREIGN KEY ("ITEM_ID")
	  REFERENCES "SWG"."MARKET_AUCTIONS" ("ITEM_ID") ON DELETE CASCADE ENABLE;
--------------------------------------------------------
--  Ref Constraints for Table MARKET_AUCTION_BIDS
--------------------------------------------------------

  ALTER TABLE "SWG"."MARKET_AUCTION_BIDS" ADD CONSTRAINT "MARKET_AUCTION_BIDS_ITEM_ID_FK" FOREIGN KEY ("ITEM_ID")
	  REFERENCES "SWG"."MARKET_AUCTIONS" ("ITEM_ID") ON DELETE CASCADE ENABLE;
--------------------------------------------------------
--  DDL for Package ADMIN
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."ADMIN" 
as
	type refcursor is ref cursor;
	subtype objectid is number;

	procedure move_to_player (p_object_id objectid, p_target_player objectid);
	procedure move_to_player_bank (p_object_id objectid, p_target_player objectid);
	procedure move_to_player_datapad (p_object_id objectid, p_target_player objectid, p_max_depth number);
	procedure move_to_container (p_object_id objectid, p_target_container objectid, p_target_load_with objectid);
	procedure move_to_container_depth (p_object_id objectid, p_target_container objectid, p_target_load_with objectid, p_max_depth number);
	function get_inventory_for_player (p_player_id objectid) return objectid;
	function get_bank_for_player (p_player_id objectid) return objectid;
	function get_datapad_for_player (p_player_id objectid) return objectid;
	function get_player_for_player (p_player_id objectid) return objectid;
	function get_container_for_object(p_object_id objectid) return objectid;
	function get_object_template_id (p_object_id objectid) return number;
	function restore_house (p_house_id objectid) return number;

	function restore_character (p_player_id objectid, p_name out varchar2, p_account out number, p_template_id out number) return number;
	function undelete_item (p_item_id objectid) return number;
	function move_item_to_player (p_object_id objectid, p_target_player objectid) return number;

	procedure fix_load_with (p_topmost_object objectid, p_starting_loadwith objectid);
	procedure fix_load_with_depth (p_topmost_object objectid, p_starting_loadwith objectid, p_max_depth number);
end;

/

  GRANT EXECUTE ON "SWG"."ADMIN" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package BIOGRAPHY
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."BIOGRAPHY" 
as
	type refcursor is ref cursor;
	subtype objectid is number;

	procedure set_biography (p_owner objectid, p_biography varchar2);
	function get_biography (p_owner objectid) return refcursor;
end;

/

  GRANT EXECUTE ON "SWG"."BIOGRAPHY" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package BLOB_DATA_CONVERSION
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."BLOB_DATA_CONVERSION" as
	function  blob_encodeoob   (v_blob blob)       return varchar2;
	function  blob_hexdump     (v_blob blob)       return varchar2;
	function  blob_encodeoob_old (v_blob blob)     return varchar2;
	function  blob_to_string   (v_blob blob)       return varchar2;
	function  string_hexdump   (v_string varchar2) return varchar2;
	procedure convert_blob_data(v_item_id number);
end;

/

  GRANT EXECUTE ON "SWG"."BLOB_DATA_CONVERSION" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package CM_LOADER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."CM_LOADER" is

  TYPE swg_cur IS REF CURSOR;

  FUNCTION get_location_list return swg_cur;
  --
  --
  --
  FUNCTION get_bid_list return swg_cur;
  --
  --
  --
  FUNCTION get_auction_list return swg_cur;
  --
  --
  --
  FUNCTION get_auction_attributes RETURN swg_cur;

end cm_loader;

/

  GRANT EXECUTE ON "SWG"."CM_LOADER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package CM_PERSISTER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."CM_PERSISTER" 
as
	type refcursor is ref cursor;
	subtype objectid is number;

	procedure update_auction_locations (p_location_id VAOFSTRING,
					 p_location_name VAOFSTRING,
					 p_owner_id VAOFSTRING,
					 p_sales_tax VAOFNUMBER,
					 p_sales_tax_bank_id VAOFSTRING,
					 p_empty_date VAOFNUMBER,
					 p_last_access_date VAOFNUMBER,
					 p_inactive_date VAOFNUMBER,
					 p_status VAOFNUMBER,
					 p_search_enabled VAOFSTRING,
					 p_entrance_charge VAOFNUMBER,
					 p_chunk_size number);
	procedure insert_auction_locations (p_location_id VAOFSTRING,
					 p_location_name VAOFSTRING,
					 p_owner_id VAOFSTRING,
					 p_sales_tax VAOFNUMBER,
					 p_sales_tax_bank_id VAOFSTRING,
					 p_empty_date VAOFNUMBER,
					 p_last_access_date VAOFNUMBER,
					 p_inactive_date VAOFNUMBER,
					 p_status VAOFNUMBER,
					 p_search_enabled VAOFSTRING,
					 p_entrance_charge VAOFNUMBER,
					 p_chunk_size number);
	procedure delete_auction_locations (p_location_id VAOFSTRING, p_chunk_size number);

	procedure insert_market_auction_bids (p_item_id VAOFSTRING,
					 p_bidder_id VAOFSTRING,
					 p_bid VAOFNUMBER,
					 p_max_proxy_bid VAOFNUMBER,
					 p_chunk_size number);

	procedure update_market_auctions (p_item_id VAOFSTRING,
					 p_owner_id VAOFSTRING,
					 p_active VAOFNUMBER,
					 p_chunk_size number);
	procedure insert_market_auctions (p_item_id VAOFSTRING,
					 p_owner_id VAOFSTRING,
					 p_creator_id VAOFSTRING,
					 p_location_id VAOFSTRING,
					 p_min_bid VAOFNUMBER,
					 p_buy_now_price VAOFNUMBER,
					 p_auction_timer VAOFNUMBER,
					 p_oob VAOFLONGSTRING,
					 p_user_description VAOFLONGSTRING,
					 p_category VAOFNUMBER,
					 p_item_name VAOFLONGSTRING,
					 p_item_timer VAOFNUMBER,
					 p_active VAOFNUMBER,
					 p_item_size VAOFNUMBER,
					 p_object_template_id VAOFNUMBER,
					 p_chunk_size number);
	procedure delete_market_auctions (p_item_id VAOFSTRING, p_chunk_size number);

	procedure insert_auction_attributes (p_item_id VAOFSTRING, p_attribute_name VAOFSTRING, p_attribute_value VAOFSTRING, p_chunk_size number);

end;

/

  GRANT EXECUTE ON "SWG"."CM_PERSISTER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package CUSTSERV_PROCS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."CUSTSERV_PROCS" 
as
	type cursortype is ref cursor;
	function get_characters_for_account
(
	station_id_in IN players.station_id%TYPE
)
 return cursortype;

	function get_deleted_items
	(
		character_id_in IN objects.load_with%TYPE,
		start_page_in IN number
	)
	return cursortype;

	function get_structures
	(
		character_id_in IN objects.object_id%TYPE
	)
	return cursortype;

	function get_player_id
	(
		character_name_in IN players.uc_character_name%TYPE
	)
	return cursortype;

	procedure move_player
	(
		character_id_in IN objects.object_id%TYPE,
		x_in IN objects.x%TYPE,
		y_in IN objects.y%TYPE,
		z_in IN objects.z%TYPE,
		scene_in IN objects.scene_id%TYPE
	);

	procedure undelete_item
	(
		character_id_in IN objects.object_id%TYPE,
		object_in IN objects.object_id%TYPE,
		move_in IN number
	);

end custserv_procs;

/

  GRANT EXECUTE ON "SWG"."CUSTSERV_PROCS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package DATALOOKUP
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."DATALOOKUP" 
as
	type refcursor is ref cursor;

	function check_character_name(p_name varchar2) return number;
	function get_structures_for_purge(p_station_id number) return refcursor;
	function get_vendors_for_purge(p_station_id number) return refcursor;

end;

/

  GRANT EXECUTE ON "SWG"."DATALOOKUP" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package DATA_CLEANUP
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."DATA_CLEANUP" 
as
   type cursortype is ref cursor;
   subtype objectid is number;

   procedure run_fix_bad_cells;
   procedure run_fix_houses_w_bad_cells;
   function getObjectsWithExpMessages return cursortype;
   function getExperienceGrants(p_object_id objectid) return cursortype;
   procedure delete_experience(p_object_id objectid);
   procedure grant_experience(p_object_id objectid, p_experience_data varchar2);
   function object_variable_name_cleanup return number;
   function orphaned_object_cleanup return number;
   function market_attributes_cleanup return number;
   function messages_cleanup return number;
   function vendor_object_cleanup return number;
   function broken_object_cleanup return number;
end;

/

  GRANT EXECUTE ON "SWG"."DATA_CLEANUP" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package DB_ERROR_LOGGER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."DB_ERROR_LOGGER" 
as

  procedure dblogerror( p_ora_errno number, p_notes varchar2 default NULL);
  procedure dblogerror_values( p_owner varchar2, p_name varchar2, p_type varchar2, p_value varchar2);
  procedure stack_search ( i_search in  integer, o_schema out varchar2, o_module out varchar2 );
  function getloglevel RETURN INTEGER;
  function reraisecheck ( p_package varchar2 default NULL, p_procedure varchar2 default NULL) return INTEGER;

end;

/

  GRANT EXECUTE ON "SWG"."DB_ERROR_LOGGER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package GOLD_OVERRIDE
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."GOLD_OVERRIDE" 
as
	type cursortype is ref cursor;

	function load_objvar_overrides(p_schema varchar2) return cursortype;
end;

/

  GRANT EXECUTE ON "SWG"."GOLD_OVERRIDE" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package LAZY_DELETER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."LAZY_DELETER" as
	procedure purge_one_object(object_in in number);
	procedure purge_objects_bulk(p_object_id VAOFSTRING, p_chunk_size number, p_enable_db_logging number);
end lazy_deleter;

/

  GRANT EXECUTE ON "SWG"."LAZY_DELETER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package LOADER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."LOADER" 
as
	type cursortype is ref cursor;

	function get_character_name_list        return cursortype;

	procedure get_version_number(current_version in out number, min_version in out number);
	function get_characters (p_station_id number) return cursortype;
	function verify_containment_chain(p_start_with_object_id in number) return number;
	function fix_player_containment_chain(p_start_with_object_id in number) return number;
	procedure verify_character (p_station_id in number, p_character_id in number, p_gold_schema in varchar2, p_approved out varchar2, p_character_name out varchar2, p_scene_id out varchar2, p_container_id out number, p_x out number, p_y out number, p_z out number, p_containment_check out number);
	function locate_player (p_object_id number) return number;
	procedure locate_universe;
	procedure locate_contained_object (p_container_id number, p_object_id number);
	function locate_by_loadwith_batch (p_loadwiths vaofstring, p_chunk_size number) return number;
	procedure locate_contents (p_container_id number);
	function load_chunk_object_list (p_scene_id varchar, p_node_x float, p_node_z float) return number;
	procedure locate_structure (p_object_id number, p_x out number, p_z out number, p_scene_id out varchar2, p_found out number);

	function load_armor                      return cursortype;
	function load_battlefield_participants   return cursortype;
	function load_property_lists             return cursortype;
	function load_experience                 return cursortype;
	function load_location                   return cursortype;
	function load_manf_schematic_attributes  return cursortype;
	function load_messages                   return cursortype;
	function load_object_variables           return cursortype;
	function load_scripts                    return cursortype;
	function load_object                     return cursortype;
	function load_waypoint                   return cursortype;
 	function load_player_object              return cursortype;
 	function load_resource_types             return cursortype;
 	function load_bounty_hunter_targets      return cursortype;

-- GENERATED PLSQL FOLLOWS
-- generated by makeloader.pl


	function	load_battlefield_marker_object			return cursortype;
	function	load_building_object								return cursortype;
	function	load_cell_object										return cursortype;
	function	load_city_object										return cursortype;
	function	load_creature_object								return cursortype;
	function	load_factory_object									return cursortype;
	function	load_guild_object										return cursortype;
	function	load_harvester_inst_object					return cursortype;
	function	load_installation_object						return cursortype;
	function	load_intangible_object							return cursortype;
	function	load_manf_schematic_object					return cursortype;
	function	load_manufacture_inst_object				return cursortype;
	function	load_mission_object									return cursortype;
	function	load_planet_object									return cursortype;
	function	load_resource_container_object			return cursortype;
	function	load_ship_object										return cursortype;
	function	load_static_object									return cursortype;
	function	load_tangible_object								return cursortype;
	function	load_token_object										return cursortype;
	function	load_universe_object								return cursortype;
	function	load_vehicle_object									return cursortype;
	function	load_weapon_object									return cursortype;
	function 	load_player_quest_object			return cursortype;
end;

/

  GRANT EXECUTE ON "SWG"."LOADER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package LOGIN
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."LOGIN" 
as
	type refcursor is ref cursor;
	subtype objectid is number;

	procedure register_new_cluster(p_cluster_name in varchar2, p_address in varchar2, p_cluster_id out number);
	function get_cluster_list(p_group in number) return refcursor;
	function get_avatar_list (p_station_id number, p_cluster_group number) return refcursor;
	function get_open_character_slots(p_station_id number, p_cluster_id number) return refcursor;
	function get_only_open_character_slots(p_station_id number, p_cluster_id number) return refcursor;
	function is_cluster_at_limit(p_cluster_id number) return number;
	function is_account_at_limit(p_station_id number) return number;
	procedure delete_character(p_cluster_id number, p_character_id number, p_station_id number);
	procedure rename_character(p_cluster_id number, p_character_id number, p_new_name varchar2);
	procedure create_character(p_cluster_id number, p_station_id number, p_character_name varchar2, p_character_id number, p_template_id number, p_character_type number);
	function restore_character(p_cluster_id number, p_station_id number, p_character_name varchar2, p_character_id number, p_template_id number, p_character_type number) return number;
	procedure set_character_slots(p_cluster_id number, p_station_id number, p_slot_type number, p_num_slots number);
	procedure set_character_type(p_cluster_id number, p_station_id number, p_character_id number, p_slot_type number);
	function has_extra_character_slot(p_station_id number, p_character_type number) return number;
	procedure toggle_disable_character(p_cluster_id number, p_character_id number, p_station_id number, p_enabled varchar2);
	function enable_disable_character(p_station_id number, p_character_id number, p_enabled varchar2) return number;
	function get_completed_tutorial(p_station_id number) return refcursor;
	procedure toggle_completed_tutorial(p_station_id number, p_completed varchar2);
	function get_consumed_reward_events(p_station_id number) return refcursor;
	function get_claimed_reward_items(p_station_id number) return refcursor;
	function consume_reward_event(p_station_id number, p_character_id number, p_cluster_id number, p_event_id varchar2) return number;
	function claim_reward_item(p_station_id number, p_character_id number, p_cluster_id number, p_item_id varchar2) return number;
	function get_feature_id_transactions(p_station_id in number, p_cluster_id in number, p_character_id in number) return refcursor;
	function update_feature_id_transaction(p_station_id in number, p_cluster_id in number, p_character_id in number, p_item_id in varchar2, p_count_adjustment in number) return number;
end;

/

  GRANT EXECUTE ON "SWG"."LOGIN" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package OBJECTIDMANAGER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."OBJECTIDMANAGER" 
as
	type cursortype is ref cursor;

	procedure get_ids(how_many in out number, block_start_id out number, block_end_id out number);
	function get_contiguous_ids(min_count number) return number;
	function get_single_id return number;

	procedure rebuild_freelist;
end;

/

  GRANT EXECUTE ON "SWG"."OBJECTIDMANAGER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package OBJVAR_NAMES
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."OBJVAR_NAMES" 
as
	type cursortype is ref cursor;

	procedure add_name (p_id number, p_name varchar2);
	function get_name_list return cursortype;
end;

/

  GRANT EXECUTE ON "SWG"."OBJVAR_NAMES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package PERSISTER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."PERSISTER" 
as
	type refcursor is ref cursor;
	subtype objectid is number;

	procedure set_clock (p_time number);
	procedure add_player (p_station_id number, p_character_object objectid, p_character_name varchar2, p_normalized_name varchar2);
	function delete_character (p_station_id number, p_character_id number, p_delete_minutes number) return number;
	procedure update_object_variable_batch (p_object_id vaofstring, p_name_id vaofnumber, p_type vaofnumber, p_value vaofstring, p_chunk_size number);
	procedure add_object_variable_batch (p_object_id vaofstring, p_name_id vaofnumber, p_type vaofnumber, p_value vaofstring, p_chunk_size number);
	procedure remove_object_variable_batch (p_object_id vaofstring, p_name_id vaofnumber, p_chunk_size number);
	procedure clear_scripts (p_object_id objectid);
	procedure save_message (p_message_id number, p_object_id objectid, p_method varchar, p_data varchar, p_call_time number, p_guaranteed varchar, p_delivery_type int);
	procedure save_message_batch (p_message_id VAOFSTRING, p_object_id VAOFSTRING, p_method VAOFSTRING, p_data VAOFLONGSTRING, p_call_time VAOFNUMBER, p_guaranteed VAOFSTRING, p_delivery_type VAOFNUMBER, p_chunk_size number, p_enable_db_logging number );
	procedure acknowledge_message (p_message_id number);
	procedure acknowledge_message_batch (p_message_id VAOFSTRING, p_chunk_size number, p_enable_db_logging number );
	procedure save_object ( p_x VAOFNUMBER, p_y VAOFNUMBER, p_z VAOFNUMBER, p_quaternion_w VAOFNUMBER, p_quaternion_x VAOFNUMBER, p_quaternion_y VAOFNUMBER, p_quaternion_z VAOFNUMBER, p_node_x VAOFNUMBER, p_node_y VAOFNUMBER, p_node_z VAOFNUMBER, p_object_template_id VAOFNUMBER, p_type_id VAOFNUMBER, p_scene_id VAOFSTRING, p_controller_type VAOFNUMBER, p_deleted VAOFNUMBER, p_object_name VAOFSTRING, p_volume VAOFNUMBER, p_contained_by VAOFSTRING, p_slot_arrangement VAOFNUMBER, p_player_controlled VAOFSTRING, p_cache_version VAOFNUMBER, p_load_contents VAOFSTRING, p_cash_balance VAOFNUMBER, p_bank_balance VAOFNUMBER, p_complexity VAOFNUMBER, p_name_string_table VAOFSTRING, p_name_string_text VAOFSTRING, p_static_item_name VAOFSTRING, p_static_item_version VAOFNUMBER, p_conversion_id VAOFNUMBER, p_load_with VAOFSTRING,
		p_objvar_0_name VAOFSTRING,p_objvar_0_type VAOFNUMBER,p_objvar_0_value VAOFSTRING,p_objvar_1_name VAOFSTRING,p_objvar_1_type VAOFNUMBER,p_objvar_1_value VAOFSTRING,p_objvar_2_name VAOFSTRING,p_objvar_2_type VAOFNUMBER,p_objvar_2_value VAOFSTRING,p_objvar_3_name VAOFSTRING,p_objvar_3_type VAOFNUMBER,p_objvar_3_value VAOFSTRING,p_objvar_4_name VAOFSTRING,p_objvar_4_type VAOFNUMBER,p_objvar_4_value VAOFSTRING,p_objvar_5_name VAOFSTRING,p_objvar_5_type VAOFNUMBER,p_objvar_5_value VAOFSTRING,p_objvar_6_name VAOFSTRING,p_objvar_6_type VAOFNUMBER,p_objvar_6_value VAOFSTRING,p_objvar_7_name VAOFSTRING,p_objvar_7_type VAOFNUMBER,p_objvar_7_value VAOFSTRING,p_objvar_8_name VAOFSTRING,p_objvar_8_type VAOFNUMBER,p_objvar_8_value VAOFSTRING,p_objvar_9_name VAOFSTRING,p_objvar_9_type VAOFNUMBER,p_objvar_9_value VAOFSTRING, p_objvar_10_name VAOFSTRING,p_objvar_10_type VAOFNUMBER,p_objvar_10_value VAOFSTRING,p_objvar_11_name VAOFSTRING,p_objvar_11_type VAOFNUMBER,p_objvar_11_value VAOFSTRING,p_objvar_12_name VAOFSTRING,p_objvar_12_type VAOFNUMBER,p_objvar_12_value VAOFSTRING,p_objvar_13_name VAOFSTRING,p_objvar_13_type VAOFNUMBER,p_objvar_13_value VAOFSTRING,p_objvar_14_name VAOFSTRING,p_objvar_14_type VAOFNUMBER,p_objvar_14_value VAOFSTRING,p_objvar_15_name VAOFSTRING,p_objvar_15_type VAOFNUMBER,p_objvar_15_value VAOFSTRING,p_objvar_16_name VAOFSTRING,p_objvar_16_type VAOFNUMBER,p_objvar_16_value VAOFSTRING,p_objvar_17_name VAOFSTRING,p_objvar_17_type VAOFNUMBER,p_objvar_17_value VAOFSTRING,p_objvar_18_name VAOFSTRING,p_objvar_18_type VAOFNUMBER,p_objvar_18_value VAOFSTRING,p_objvar_19_name VAOFSTRING,p_objvar_19_type VAOFNUMBER,p_objvar_19_value VAOFSTRING, p_script_list VAOFLONGSTRING, p_object_id VAOFSTRING, p_chunk_size number);
	procedure add_object ( p_x VAOFNUMBER, p_y VAOFNUMBER, p_z VAOFNUMBER, p_quaternion_w VAOFNUMBER, p_quaternion_x VAOFNUMBER, p_quaternion_y VAOFNUMBER, p_quaternion_z VAOFNUMBER, p_node_x VAOFNUMBER, p_node_y VAOFNUMBER, p_node_z VAOFNUMBER, p_object_template_id VAOFNUMBER, p_type_id VAOFNUMBER, p_scene_id VAOFSTRING, p_controller_type VAOFNUMBER, p_deleted VAOFNUMBER, p_object_name VAOFSTRING, p_volume VAOFNUMBER, p_contained_by VAOFSTRING, p_slot_arrangement VAOFNUMBER, p_player_controlled VAOFSTRING, p_cache_version VAOFNUMBER, p_load_contents VAOFSTRING, p_cash_balance VAOFNUMBER, p_bank_balance VAOFNUMBER, p_complexity VAOFNUMBER, p_name_string_table VAOFSTRING, p_name_string_text VAOFSTRING, p_static_item_name VAOFSTRING, p_static_item_version VAOFNUMBER, p_conversion_id VAOFNUMBER, p_load_with VAOFSTRING,
		p_objvar_0_name VAOFSTRING,p_objvar_0_type VAOFNUMBER,p_objvar_0_value VAOFSTRING,p_objvar_1_name VAOFSTRING,p_objvar_1_type VAOFNUMBER,p_objvar_1_value VAOFSTRING,p_objvar_2_name VAOFSTRING,p_objvar_2_type VAOFNUMBER,p_objvar_2_value VAOFSTRING,p_objvar_3_name VAOFSTRING,p_objvar_3_type VAOFNUMBER,p_objvar_3_value VAOFSTRING,p_objvar_4_name VAOFSTRING,p_objvar_4_type VAOFNUMBER,p_objvar_4_value VAOFSTRING,p_objvar_5_name VAOFSTRING,p_objvar_5_type VAOFNUMBER,p_objvar_5_value VAOFSTRING,p_objvar_6_name VAOFSTRING,p_objvar_6_type VAOFNUMBER,p_objvar_6_value VAOFSTRING,p_objvar_7_name VAOFSTRING,p_objvar_7_type VAOFNUMBER,p_objvar_7_value VAOFSTRING,p_objvar_8_name VAOFSTRING,p_objvar_8_type VAOFNUMBER,p_objvar_8_value VAOFSTRING,p_objvar_9_name VAOFSTRING,p_objvar_9_type VAOFNUMBER,p_objvar_9_value VAOFSTRING, p_objvar_10_name VAOFSTRING,p_objvar_10_type VAOFNUMBER,p_objvar_10_value VAOFSTRING,p_objvar_11_name VAOFSTRING,p_objvar_11_type VAOFNUMBER,p_objvar_11_value VAOFSTRING,p_objvar_12_name VAOFSTRING,p_objvar_12_type VAOFNUMBER,p_objvar_12_value VAOFSTRING,p_objvar_13_name VAOFSTRING,p_objvar_13_type VAOFNUMBER,p_objvar_13_value VAOFSTRING,p_objvar_14_name VAOFSTRING,p_objvar_14_type VAOFNUMBER,p_objvar_14_value VAOFSTRING,p_objvar_15_name VAOFSTRING,p_objvar_15_type VAOFNUMBER,p_objvar_15_value VAOFSTRING,p_objvar_16_name VAOFSTRING,p_objvar_16_type VAOFNUMBER,p_objvar_16_value VAOFSTRING,p_objvar_17_name VAOFSTRING,p_objvar_17_type VAOFNUMBER,p_objvar_17_value VAOFSTRING,p_objvar_18_name VAOFSTRING,p_objvar_18_type VAOFNUMBER,p_objvar_18_value VAOFSTRING,p_objvar_19_name VAOFSTRING,p_objvar_19_type VAOFNUMBER,p_objvar_19_value VAOFSTRING, p_script_list VAOFLONGSTRING, p_object_id VAOFSTRING, p_chunk_size number);
	procedure remove_object ( p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_manf_schem_attribute (p_action number, p_object_id objectid, p_attribute_type varchar2, p_value number);
	procedure update_property_list (p_object_id objectid, p_list_id number, p_operation number, p_value varchar2);
	procedure update_property_list_batch (p_object_id VAOFSTRING, p_list_id VAOFNUMBER, p_operation number, p_value VAOFSTRING, p_chunk_size number, p_enable_db_logging number );
	procedure save_armor (p_object_template varchar2, p_effectiveness number, p_integrity number, p_special_protections varchar2, p_encumberance_0 number, p_encumberance_1 number, p_encumberance_2 number, p_encumberance_3 number, p_encumberance_4 number, p_encumberance_5 number, p_encumberance_6 number, p_encumberance_7 number, p_encumberance_8 number, p_layer number, p_object_id objectid);
	procedure add_armor (p_object_template varchar2, p_effectiveness number, p_integrity number, p_special_protections varchar2, p_encumberance_0 number, p_encumberance_1 number, p_encumberance_2 number, p_encumberance_3 number, p_encumberance_4 number, p_encumberance_5 number, p_encumberance_6 number, p_encumberance_7 number, p_encumberance_8 number, p_layer number, p_object_id objectid);
	procedure save_location ( p_object_id number, p_list_id number, p_sequence_number number, p_operation number, p_name varchar2, p_scene varchar2, p_x number, p_y number, p_z number, p_radius number);
	procedure save_experience ( p_points number, p_experience_type varchar2, p_object_id number );
	procedure save_battlefield_participants ( p_faction_id number, p_character_object_id number, p_region_object_id number );
	function  rename_character( p_character_id objectid, p_new_name varchar2, p_normalized_name varchar2) return number;
	procedure save_waypoint(p_object_id objectid, p_waypoint_id objectid, p_appearance_name_crc number, p_location_x number, p_location_y number, p_location_z number, p_location_cell number, p_location_scene number, p_name varchar2, p_color number, p_active char, p_detached char);
 	procedure save_player_obj( p_object_id VAOFSTRING, p_station_id VAOFNUMBER, p_house_id VAOFSTRING, p_account_num_lots VAOFNUMBER, p_account_is_outcast VAOFSTRING, p_account_cheater_level VAOFNUMBER, p_account_max_lots_adjustment VAOFNUMBER, p_personal_profile_id VAOFSTRING, p_character_profile_id VAOFSTRING, p_skill_title VAOFSTRING, p_born_date VAOFNUMBER, p_played_time VAOFNUMBER, p_force_regen_rate VAOFNUMBER, p_force_power VAOFNUMBER, p_max_force_power VAOFNUMBER, p_active_quests VAOFSTRING, p_completed_quests VAOFSTRING, p_current_quest VAOFNUMBER, p_quests VAOFLONGSTRING, p_role_icon_choice VAOFNUMBER, p_quests2 VAOFLONGSTRING, p_quests3 VAOFLONGSTRING, p_quests4 VAOFLONGSTRING, p_skill_template VAOFSTRING, p_working_skill VAOFSTRING, p_current_gcw_points VAOFNUMBER, p_current_gcw_rating VAOFNUMBER, p_current_pvp_kills VAOFNUMBER, p_lifetime_gcw_points VAOFNUMBER, p_max_gcw_imperial_rating VAOFNUMBER, p_max_gcw_rebel_rating VAOFNUMBER, p_lifetime_pvp_kills VAOFNUMBER, p_next_gcw_rating_calc_time VAOFNUMBER, p_collections VAOFLONGSTRING, p_show_backpack VAOFSTRING, p_show_helmet VAOFSTRING, p_collections2 VAOFLONGSTRING, p_chunk_size number );
	procedure add_player_obj( p_object_id VAOFSTRING, p_station_id VAOFNUMBER, p_house_id VAOFSTRING, p_account_num_lots VAOFNUMBER, p_account_is_outcast VAOFSTRING, p_account_cheater_level VAOFNUMBER, p_account_max_lots_adjustment VAOFNUMBER, p_personal_profile_id VAOFSTRING, p_character_profile_id VAOFSTRING, p_skill_title VAOFSTRING, p_born_date VAOFNUMBER, p_played_time VAOFNUMBER, p_force_regen_rate VAOFNUMBER, p_force_power VAOFNUMBER, p_max_force_power VAOFNUMBER, p_active_quests VAOFSTRING, p_completed_quests VAOFSTRING, p_current_quest VAOFNUMBER, p_quests VAOFLONGSTRING, p_role_icon_choice VAOFNUMBER, p_quests2 VAOFLONGSTRING, p_quests3 VAOFLONGSTRING, p_quests4 VAOFLONGSTRING, p_skill_template VAOFSTRING, p_working_skill VAOFSTRING, p_current_gcw_points VAOFNUMBER, p_current_gcw_rating VAOFNUMBER, p_current_pvp_kills VAOFNUMBER, p_lifetime_gcw_points VAOFNUMBER, p_max_gcw_imperial_rating VAOFNUMBER, p_max_gcw_rebel_rating VAOFNUMBER, p_lifetime_pvp_kills VAOFNUMBER, p_next_gcw_rating_calc_time VAOFNUMBER, p_collections VAOFLONGSTRING, p_show_backpack VAOFSTRING, p_show_helmet VAOFSTRING, p_collections2 VAOFLONGSTRING, p_chunk_size number );
	procedure remove_player_obj( p_object_id VAOFSTRING, p_chunk_size number );
	procedure delete_demand_container( p_object_id VAOFSTRING, p_reason VAOFNUMBER, p_chunk_size number );
	procedure save_resource_type(p_resource_id VAOFSTRING, p_resource_name VAOFSTRING, p_resource_class VAOFSTRING, p_attributes VAOFSTRING, p_fractal_seeds VAOFSTRING, p_depleted_timestamp VAOFNUMBER, p_chunk_size number);
	procedure save_bounty_hunter_target(p_object_id VAOFSTRING, p_target_id VAOFSTRING, p_chunk_size number);
	function subtract_money_from_object(p_object_id number, p_amount number) return char;

-- GENERATED PLSQL FOLLOWS
-- generated by makepersister.pl
	procedure save_battlefield_marker_obj(p_object_id VAOFSTRING, p_region_name VAOFSTRING, p_chunk_size number);
	procedure add_battlefield_marker_obj(p_object_id VAOFSTRING, p_region_name VAOFSTRING, p_chunk_size number);
	procedure remove_battlefield_marker_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_building_obj(p_object_id VAOFSTRING, p_maintenance_cost VAOFNUMBER, p_time_last_checked VAOFNUMBER, p_is_public VAOFSTRING, p_city_id VAOFNUMBER, p_chunk_size number);
	procedure add_building_obj(p_object_id VAOFSTRING, p_maintenance_cost VAOFNUMBER, p_time_last_checked VAOFNUMBER, p_is_public VAOFSTRING, p_city_id VAOFNUMBER, p_chunk_size number);
	procedure remove_building_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_cell_obj(p_object_id VAOFSTRING, p_cell_number VAOFNUMBER, p_is_public VAOFSTRING, p_chunk_size number);
	procedure add_cell_obj(p_object_id VAOFSTRING, p_cell_number VAOFNUMBER, p_is_public VAOFSTRING, p_chunk_size number);
	procedure remove_cell_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_city_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure add_city_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure remove_city_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_creature_obj(p_object_id VAOFSTRING, p_scale_factor VAOFNUMBER, p_states VAOFNUMBER, p_posture VAOFNUMBER, p_shock_wounds VAOFNUMBER, p_master_id VAOFSTRING, p_rank VAOFNUMBER, p_base_walk_speed VAOFNUMBER, p_base_run_speed VAOFNUMBER, p_attribute_0 VAOFNUMBER, p_attribute_1 VAOFNUMBER, p_attribute_2 VAOFNUMBER, p_attribute_3 VAOFNUMBER, p_attribute_4 VAOFNUMBER, p_attribute_5 VAOFNUMBER, p_attribute_6 VAOFNUMBER, p_attribute_7 VAOFNUMBER, p_attribute_8 VAOFNUMBER, p_attribute_9 VAOFNUMBER, p_attribute_10 VAOFNUMBER, p_attribute_11 VAOFNUMBER, p_attribute_12 VAOFNUMBER, p_attribute_13 VAOFNUMBER, p_attribute_14 VAOFNUMBER, p_attribute_15 VAOFNUMBER, p_attribute_16 VAOFNUMBER, p_attribute_17 VAOFNUMBER, p_attribute_18 VAOFNUMBER, p_attribute_19 VAOFNUMBER, p_attribute_20 VAOFNUMBER, p_attribute_21 VAOFNUMBER, p_attribute_22 VAOFNUMBER, p_attribute_23 VAOFNUMBER, p_attribute_24 VAOFNUMBER, p_attribute_25 VAOFNUMBER, p_attribute_26 VAOFNUMBER, p_persisted_buffs VAOFSTRING, p_ws_x VAOFNUMBER, p_ws_y VAOFNUMBER, p_ws_z VAOFNUMBER, p_chunk_size number);
	procedure add_creature_obj(p_object_id VAOFSTRING, p_scale_factor VAOFNUMBER, p_states VAOFNUMBER, p_posture VAOFNUMBER, p_shock_wounds VAOFNUMBER, p_master_id VAOFSTRING, p_rank VAOFNUMBER, p_base_walk_speed VAOFNUMBER, p_base_run_speed VAOFNUMBER, p_attribute_0 VAOFNUMBER, p_attribute_1 VAOFNUMBER, p_attribute_2 VAOFNUMBER, p_attribute_3 VAOFNUMBER, p_attribute_4 VAOFNUMBER, p_attribute_5 VAOFNUMBER, p_attribute_6 VAOFNUMBER, p_attribute_7 VAOFNUMBER, p_attribute_8 VAOFNUMBER, p_attribute_9 VAOFNUMBER, p_attribute_10 VAOFNUMBER, p_attribute_11 VAOFNUMBER, p_attribute_12 VAOFNUMBER, p_attribute_13 VAOFNUMBER, p_attribute_14 VAOFNUMBER, p_attribute_15 VAOFNUMBER, p_attribute_16 VAOFNUMBER, p_attribute_17 VAOFNUMBER, p_attribute_18 VAOFNUMBER, p_attribute_19 VAOFNUMBER, p_attribute_20 VAOFNUMBER, p_attribute_21 VAOFNUMBER, p_attribute_22 VAOFNUMBER, p_attribute_23 VAOFNUMBER, p_attribute_24 VAOFNUMBER, p_attribute_25 VAOFNUMBER, p_attribute_26 VAOFNUMBER, p_persisted_buffs VAOFSTRING, p_ws_x VAOFNUMBER, p_ws_y VAOFNUMBER, p_ws_z VAOFNUMBER, p_chunk_size number);
	procedure remove_creature_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_factory_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure add_factory_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure remove_factory_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_guild_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure add_guild_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure remove_guild_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_harvester_inst_obj(p_object_id VAOFSTRING, p_installed_efficiency VAOFNUMBER, p_max_extraction_rate VAOFNUMBER, p_current_extraction_rate VAOFNUMBER, p_max_hopper_amount VAOFNUMBER, p_hopper_resource VAOFSTRING, p_hopper_amount VAOFNUMBER, p_resource_type VAOFSTRING, p_chunk_size number);
	procedure add_harvester_inst_obj(p_object_id VAOFSTRING, p_installed_efficiency VAOFNUMBER, p_max_extraction_rate VAOFNUMBER, p_current_extraction_rate VAOFNUMBER, p_max_hopper_amount VAOFNUMBER, p_hopper_resource VAOFSTRING, p_hopper_amount VAOFNUMBER, p_resource_type VAOFSTRING, p_chunk_size number);
	procedure remove_harvester_inst_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_installation_obj(p_object_id VAOFSTRING, p_installation_type VAOFNUMBER, p_activated VAOFSTRING, p_tick_count VAOFNUMBER, p_activate_start_time VAOFNUMBER, p_power VAOFNUMBER, p_power_rate VAOFNUMBER, p_chunk_size number);
	procedure add_installation_obj(p_object_id VAOFSTRING, p_installation_type VAOFNUMBER, p_activated VAOFSTRING, p_tick_count VAOFNUMBER, p_activate_start_time VAOFNUMBER, p_power VAOFNUMBER, p_power_rate VAOFNUMBER, p_chunk_size number);
	procedure remove_installation_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_intangible_obj(p_object_id VAOFSTRING, p_count VAOFNUMBER, p_chunk_size number);
	procedure add_intangible_obj(p_object_id VAOFSTRING, p_count VAOFNUMBER, p_chunk_size number);
	procedure remove_intangible_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_manf_schematic_obj(p_object_id VAOFSTRING, p_creator_id VAOFSTRING, p_creator_name VAOFSTRING, p_items_per_container VAOFNUMBER, p_manufacture_time VAOFNUMBER, p_draft_schematic VAOFNUMBER, p_chunk_size number);
	procedure add_manf_schematic_obj(p_object_id VAOFSTRING, p_creator_id VAOFSTRING, p_creator_name VAOFSTRING, p_items_per_container VAOFNUMBER, p_manufacture_time VAOFNUMBER, p_draft_schematic VAOFNUMBER, p_chunk_size number);
	procedure remove_manf_schematic_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_manufacture_inst_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure add_manufacture_inst_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure remove_manufacture_inst_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_mission_obj(p_object_id VAOFSTRING, p_difficulty VAOFNUMBER, p_end_x VAOFNUMBER, p_end_y VAOFNUMBER, p_end_z VAOFNUMBER, p_end_cell VAOFSTRING, p_end_scene VAOFNUMBER, p_mission_creator VAOFSTRING, p_reward VAOFNUMBER, p_root_script_name VAOFSTRING, p_start_x VAOFNUMBER, p_start_y VAOFNUMBER, p_start_z VAOFNUMBER, p_start_cell VAOFSTRING, p_start_scene VAOFNUMBER, p_description_table VAOFSTRING, p_description_text VAOFSTRING, p_title_table VAOFSTRING, p_title_text VAOFSTRING, p_mission_holder_id VAOFSTRING, p_status VAOFNUMBER, p_mission_type VAOFNUMBER, p_target_appearance VAOFNUMBER, p_target_name VAOFSTRING, p_chunk_size number);
	procedure add_mission_obj(p_object_id VAOFSTRING, p_difficulty VAOFNUMBER, p_end_x VAOFNUMBER, p_end_y VAOFNUMBER, p_end_z VAOFNUMBER, p_end_cell VAOFSTRING, p_end_scene VAOFNUMBER, p_mission_creator VAOFSTRING, p_reward VAOFNUMBER, p_root_script_name VAOFSTRING, p_start_x VAOFNUMBER, p_start_y VAOFNUMBER, p_start_z VAOFNUMBER, p_start_cell VAOFSTRING, p_start_scene VAOFNUMBER, p_description_table VAOFSTRING, p_description_text VAOFSTRING, p_title_table VAOFSTRING, p_title_text VAOFSTRING, p_mission_holder_id VAOFSTRING, p_status VAOFNUMBER, p_mission_type VAOFNUMBER, p_target_appearance VAOFNUMBER, p_target_name VAOFSTRING, p_chunk_size number);
	procedure remove_mission_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_planet_obj(p_object_id VAOFSTRING, p_planet_name VAOFSTRING, p_chunk_size number);
	procedure add_planet_obj(p_object_id VAOFSTRING, p_planet_name VAOFSTRING, p_chunk_size number);
	procedure remove_planet_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_resource_container_obj(p_object_id VAOFSTRING, p_resource_type VAOFSTRING, p_quantity VAOFNUMBER, p_source VAOFSTRING, p_chunk_size number);
	procedure add_resource_container_obj(p_object_id VAOFSTRING, p_resource_type VAOFSTRING, p_quantity VAOFNUMBER, p_source VAOFSTRING, p_chunk_size number);
	procedure remove_resource_container_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_ship_obj(p_object_id VAOFSTRING, p_slide_dampener VAOFNUMBER, p_current_chassis_hit_points VAOFNUMBER, p_maximum_chassis_hit_points VAOFNUMBER, p_chassis_type VAOFNUMBER, p_cmp_armor_hp_maximum VAOFSTRING, p_cmp_armor_hp_current VAOFSTRING, p_cmp_efficiency_general VAOFSTRING, p_cmp_efficiency_eng VAOFSTRING, p_cmp_eng_maintenance VAOFSTRING, p_cmp_mass VAOFSTRING, p_cmp_crc VAOFSTRING, p_cmp_hp_current VAOFSTRING, p_cmp_hp_maximum VAOFSTRING, p_cmp_flags VAOFSTRING, p_cmp_names VAOFLONGSTRING, p_weapon_damage_maximum VAOFSTRING, p_weapon_damage_minimum VAOFSTRING, p_weapon_effectiveness_shields VAOFSTRING, p_weapon_effectiveness_armor VAOFSTRING, p_weapon_eng_per_shot VAOFSTRING, p_weapon_refire_rate VAOFSTRING, p_weapon_ammo_current VAOFSTRING, p_weapon_ammo_maximum VAOFSTRING, p_weapon_ammo_type VAOFSTRING, p_shield_hp_front_maximum VAOFNUMBER, p_shield_hp_back_maximum VAOFNUMBER, p_shield_recharge_rate VAOFNUMBER, p_capacitor_eng_maximum VAOFNUMBER, p_capacitor_eng_recharge_rate VAOFNUMBER, p_engine_acc_rate VAOFNUMBER, p_engine_deceleration_rate VAOFNUMBER, p_engine_pitch_acc_rate VAOFNUMBER, p_engine_yaw_acc_rate VAOFNUMBER, p_engine_roll_acc_rate VAOFNUMBER, p_engine_pitch_rate_maximum VAOFNUMBER, p_engine_yaw_rate_maximum VAOFNUMBER, p_engine_roll_rate_maximum VAOFNUMBER, p_engine_speed_maximum VAOFNUMBER, p_reactor_eng_generation_rate VAOFNUMBER, p_booster_eng_maximum VAOFNUMBER, p_booster_eng_recharge_rate VAOFNUMBER, p_booster_eng_consumption_rate VAOFNUMBER, p_booster_acc VAOFNUMBER, p_booster_speed_maximum VAOFNUMBER, p_droid_if_cmd_speed VAOFNUMBER, p_installed_dcd VAOFSTRING, p_chassis_cmp_mass_maximum VAOFNUMBER, p_cmp_creators VAOFSTRING, p_cargo_hold_contents_maximum VAOFNUMBER, p_cargo_hold_contents_current VAOFNUMBER, p_cargo_hold_contents VAOFSTRING, p_chunk_size number);
	procedure add_ship_obj(p_object_id VAOFSTRING, p_slide_dampener VAOFNUMBER, p_current_chassis_hit_points VAOFNUMBER, p_maximum_chassis_hit_points VAOFNUMBER, p_chassis_type VAOFNUMBER, p_cmp_armor_hp_maximum VAOFSTRING, p_cmp_armor_hp_current VAOFSTRING, p_cmp_efficiency_general VAOFSTRING, p_cmp_efficiency_eng VAOFSTRING, p_cmp_eng_maintenance VAOFSTRING, p_cmp_mass VAOFSTRING, p_cmp_crc VAOFSTRING, p_cmp_hp_current VAOFSTRING, p_cmp_hp_maximum VAOFSTRING, p_cmp_flags VAOFSTRING, p_cmp_names VAOFLONGSTRING, p_weapon_damage_maximum VAOFSTRING, p_weapon_damage_minimum VAOFSTRING, p_weapon_effectiveness_shields VAOFSTRING, p_weapon_effectiveness_armor VAOFSTRING, p_weapon_eng_per_shot VAOFSTRING, p_weapon_refire_rate VAOFSTRING, p_weapon_ammo_current VAOFSTRING, p_weapon_ammo_maximum VAOFSTRING, p_weapon_ammo_type VAOFSTRING, p_shield_hp_front_maximum VAOFNUMBER, p_shield_hp_back_maximum VAOFNUMBER, p_shield_recharge_rate VAOFNUMBER, p_capacitor_eng_maximum VAOFNUMBER, p_capacitor_eng_recharge_rate VAOFNUMBER, p_engine_acc_rate VAOFNUMBER, p_engine_deceleration_rate VAOFNUMBER, p_engine_pitch_acc_rate VAOFNUMBER, p_engine_yaw_acc_rate VAOFNUMBER, p_engine_roll_acc_rate VAOFNUMBER, p_engine_pitch_rate_maximum VAOFNUMBER, p_engine_yaw_rate_maximum VAOFNUMBER, p_engine_roll_rate_maximum VAOFNUMBER, p_engine_speed_maximum VAOFNUMBER, p_reactor_eng_generation_rate VAOFNUMBER, p_booster_eng_maximum VAOFNUMBER, p_booster_eng_recharge_rate VAOFNUMBER, p_booster_eng_consumption_rate VAOFNUMBER, p_booster_acc VAOFNUMBER, p_booster_speed_maximum VAOFNUMBER, p_droid_if_cmd_speed VAOFNUMBER, p_installed_dcd VAOFSTRING, p_chassis_cmp_mass_maximum VAOFNUMBER, p_cmp_creators VAOFSTRING, p_cargo_hold_contents_maximum VAOFNUMBER, p_cargo_hold_contents_current VAOFNUMBER, p_cargo_hold_contents VAOFSTRING, p_chunk_size number);
	procedure remove_ship_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_static_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure add_static_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure remove_static_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_tangible_obj(p_object_id VAOFSTRING, p_max_hit_points VAOFNUMBER, p_owner_id VAOFSTRING, p_visible VAOFSTRING, p_appearance_data VAOFSTRING, p_interest_radius VAOFNUMBER, p_pvp_type VAOFNUMBER, p_pvp_faction VAOFNUMBER, p_damage_taken VAOFNUMBER, p_custom_appearance VAOFSTRING, p_count VAOFNUMBER, p_condition VAOFNUMBER, p_creator_id VAOFSTRING, p_source_draft_schematic VAOFNUMBER, p_chunk_size number);
	procedure add_tangible_obj(p_object_id VAOFSTRING, p_max_hit_points VAOFNUMBER, p_owner_id VAOFSTRING, p_visible VAOFSTRING, p_appearance_data VAOFSTRING, p_interest_radius VAOFNUMBER, p_pvp_type VAOFNUMBER, p_pvp_faction VAOFNUMBER, p_damage_taken VAOFNUMBER, p_custom_appearance VAOFSTRING, p_count VAOFNUMBER, p_condition VAOFNUMBER, p_creator_id VAOFSTRING, p_source_draft_schematic VAOFNUMBER, p_chunk_size number);
	procedure remove_tangible_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_token_obj(p_object_id VAOFSTRING, p_reference VAOFSTRING, p_target_server_template_name VAOFSTRING, p_target_shared_template_name VAOFSTRING, p_waypoint VAOFSTRING, p_chunk_size number);
	procedure add_token_obj(p_object_id VAOFSTRING, p_reference VAOFSTRING, p_target_server_template_name VAOFSTRING, p_target_shared_template_name VAOFSTRING, p_waypoint VAOFSTRING, p_chunk_size number);
	procedure remove_token_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_universe_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure add_universe_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure remove_universe_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_vehicle_obj(p_object_id VAOFSTRING, p_bogus VAOFNUMBER, p_chunk_size number);
	procedure add_vehicle_obj(p_object_id VAOFSTRING, p_bogus VAOFNUMBER, p_chunk_size number);
	procedure remove_vehicle_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_weapon_obj(p_object_id VAOFSTRING, p_min_damage VAOFNUMBER, p_max_damage VAOFNUMBER, p_damage_type VAOFNUMBER, p_elemental_type VAOFNUMBER, p_elemental_value VAOFNUMBER, p_attack_speed VAOFNUMBER, p_wound_chance VAOFNUMBER, p_accuracy VAOFNUMBER, p_attack_cost VAOFNUMBER, p_damage_radius VAOFNUMBER, p_min_range VAOFNUMBER, p_max_range VAOFNUMBER, p_chunk_size number);
	procedure add_weapon_obj(p_object_id VAOFSTRING, p_min_damage VAOFNUMBER, p_max_damage VAOFNUMBER, p_damage_type VAOFNUMBER, p_elemental_type VAOFNUMBER, p_elemental_value VAOFNUMBER, p_attack_speed VAOFNUMBER, p_wound_chance VAOFNUMBER, p_accuracy VAOFNUMBER, p_attack_cost VAOFNUMBER, p_damage_radius VAOFNUMBER, p_min_range VAOFNUMBER, p_max_range VAOFNUMBER, p_chunk_size number);
	procedure remove_weapon_obj(p_object_id VAOFSTRING, p_chunk_size number);
	procedure save_player_quest_obj( p_object_id VAOFSTRING, p_title VAOFSTRING, p_description VAOFSTRING, p_creator VAOFSTRING, p_total_tasks VAOFNUMBER, p_difficulty VAOFNUMBER, p_task_title1 VAOFSTRING, p_task_description1 VAOFSTRING, p_task_title2 VAOFSTRING, p_task_description2 VAOFSTRING, p_task_title3 VAOFSTRING, p_task_description3 VAOFSTRING, p_task_title4 VAOFSTRING, p_task_description4 VAOFSTRING, p_task_title5 VAOFSTRING, p_task_description5 VAOFSTRING, p_task_title6 VAOFSTRING, p_task_description6 VAOFSTRING, p_task_title7 VAOFSTRING, p_task_description7 VAOFSTRING, p_task_title8 VAOFSTRING, p_task_description8 VAOFSTRING, p_task_title9 VAOFSTRING, p_task_description9 VAOFSTRING, p_task_title10 VAOFSTRING, p_task_description10 VAOFSTRING, p_task_title11 VAOFSTRING, p_task_description11 VAOFSTRING, p_task_title12 VAOFSTRING, p_task_description12 VAOFSTRING, p_chunk_size number );
	procedure add_player_quest_obj( p_object_id VAOFSTRING, p_title VAOFSTRING, p_description VAOFSTRING, p_creator VAOFSTRING, p_total_tasks VAOFNUMBER, p_difficulty VAOFNUMBER, p_task_title1 VAOFSTRING, p_task_description1 VAOFSTRING, p_task_title2 VAOFSTRING, p_task_description2 VAOFSTRING, p_task_title3 VAOFSTRING, p_task_description3 VAOFSTRING, p_task_title4 VAOFSTRING, p_task_description4 VAOFSTRING, p_task_title5 VAOFSTRING, p_task_description5 VAOFSTRING, p_task_title6 VAOFSTRING, p_task_description6 VAOFSTRING, p_task_title7 VAOFSTRING, p_task_description7 VAOFSTRING, p_task_title8 VAOFSTRING, p_task_description8 VAOFSTRING, p_task_title9 VAOFSTRING, p_task_description9 VAOFSTRING, p_task_title10 VAOFSTRING, p_task_description10 VAOFSTRING, p_task_title11 VAOFSTRING, p_task_description11 VAOFSTRING, p_task_title12 VAOFSTRING, p_task_description12 VAOFSTRING, p_chunk_size number );
	procedure remove_player_quest_obj( p_object_id VAOFSTRING, p_chunk_size number);

end;

/

  GRANT EXECUTE ON "SWG"."PERSISTER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package PURGE_METHODS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."PURGE_METHODS" is

  -- Author  : AVALDES
  -- Created : 19-Jun-03 4:59:49 PM


  FUNCTION Purge_objects
    (date_in       in objects.deleted_date%type)
  RETURN NUMBER;
  --
  --
  --
  FUNCTION time_purge
    (date_in          IN VARCHAR2)
  RETURN INTEGER;


end purge_methods;

/

  GRANT EXECUTE ON "SWG"."PURGE_METHODS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package PURGE_METHODS2
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."PURGE_METHODS2" is

  -- Author  : AVALDES
  -- Created : 19-Jun-03 4:59:49 PM
  -- Modified: 07/23/2003, DDM - changed to use bulk deleting and variable chunk size

  -- Notes: 07/29/2003 testing completed against a copy of SDKSWG04 on sdk-devdb
  --        Tested running purge_objects from SYSDATE back on ~675k parent objects
  --          -test run 1: ~40 min to delete all child and parent obj in batches of 10K
  --          -test run 2: ~2.5 hours to do the same with rman running
  --        Tested run purge_consumables from SYSDATE back on ~300k parent objects
  --          -test run 1: ~50 min to delete all child and parent obj in batches of 10K
  --          -test run 2: crashed with snap to old error - restarted and it finished the rest
  --
  -- Progress can be gauged by looking in the Logger table. There is a logging system being
  -- used to track deletion progress. It can be disabled pro commentting out references to
  -- the 'LOGGING' package. This package is not necessary for the purge program to run but is
  -- nice to be able to monitor progress. If used, the logger table should be cleared periodically.


  -- number of records to delete in a bulk chunk
  chunk_size  CONSTANT PLS_INTEGER := 10000;

  -- collections for bulk deleting, # elements must be the same as chunk_size
  TYPE Obj_list_t IS VARRAY(10000) of objects.object_id%type; -- for child table with object ids
  TYPE Obj_rowid_list_t IS VARRAY(10000) of ROWID; -- for parent table (rowid lookups are faster)

  FUNCTION Purge_objects
    (date_in       in objects.deleted_date%type)
  RETURN PLS_INTEGER;

  PROCEDURE Purge_objects_work
    (Obj_list IN Obj_list_t);
  --
  --
  --
  FUNCTION time_purge
    (date_in          IN VARCHAR2)
  RETURN PLS_INTEGER;

  FUNCTION Purge_consumables
    (start_date_in       in objects.deleted_date%type,
     end_date_in         in objects.deleted_date%type)
  RETURN PLS_INTEGER;

  PROCEDURE Purge_consumables_work
    (Obj_list IN Obj_list_t);
  --
  --
  --
  FUNCTION time_purge_consumables
    (start_date_in       in objects.deleted_date%type,
     end_date_in         in objects.deleted_date%type)
  RETURN PLS_INTEGER;


end purge_methods2;

/

  GRANT EXECUTE ON "SWG"."PURGE_METHODS2" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package PURGE_PROCESS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."PURGE_PROCESS" 
as
	type refcursor is ref cursor;
	subtype objectid is number;

	procedure update_account_list (source_table varchar2);
	function get_account_for_purge(p_purge_phase number, p_min_age number) return number;
	procedure set_purge_status(p_station_id number, p_new_phase number);
end;

/

  GRANT EXECUTE ON "SWG"."PURGE_PROCESS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package SERVERCLOCK
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."SERVERCLOCK" 
as
	function get_last_save_time return number;
end;

/

  GRANT EXECUTE ON "SWG"."SERVERCLOCK" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package STATION_PLAYERS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."STATION_PLAYERS" 
as
	type refcursor is ref cursor;
	subtype networkid is number(20);

	procedure update_character(p_clusterName in varchar2 ,p_characterId in networkid, p_characterName in varchar2, p_objectName in varchar2, p_x in number, p_y in number, p_z in number, p_sceneId in varchar2, p_cash_balance in number, p_bank_balance in number, p_objectTemplateName in varchar2, p_stationId in networkid, p_containedBy in networkid, p_createTime in number, p_playedTime in number , p_numLots in number);
end;

/

  GRANT EXECUTE ON "SWG"."STATION_PLAYERS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package UNDELETE_METHODS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."UNDELETE_METHODS" is

  -- Author  : AVALDES
  -- Created : 17-Jun-03 3:35:25 PM

  FUNCTION restore_object
    (object_id_in     IN objects.object_id%TYPE)
  RETURN NUMBER;


end undelete_methods;

/

  GRANT EXECUTE ON "SWG"."UNDELETE_METHODS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package UTIL
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE "SWG"."UTIL" 
as
	type refcursor is ref cursor;
	subtype networkid is number(20);

	function unix_time_2_oracle_date_PDT(p_unix_time in number) return date;
	function unix_time_2_oracle_date_PST(p_unix_time in number) return date;
	function unix_time_2_oracle_date_CDT(p_unix_time in number) return date;
	function unix_time_2_oracle_date_CST(p_unix_time in number) return date;
	function unix_time_2_oracle_date(p_unix_time in number, p_timezone_offset in number) return date;
	function unix_to_oracle_date(p_unix_time in number, p_timezone_offset in number) return date;

end;

/

  GRANT EXECUTE ON "SWG"."UTIL" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body ADMIN
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."ADMIN" 
as

	procedure move_to_player (p_object_id objectid, p_target_player objectid)
	as
		l_target_inventory objectid;
	begin
		l_target_inventory := admin.get_inventory_for_player(p_target_player);

		if (l_target_inventory <> 0) then
			move_to_container(p_object_id, l_target_inventory, p_target_player);
		end if;
	end;

	procedure move_to_player_bank (p_object_id objectid, p_target_player objectid)
	as
		l_target_bank objectid;
	begin
		l_target_bank := admin.get_bank_for_player(p_target_player);

		if (l_target_bank <> 0) then
			move_to_container(p_object_id, l_target_bank, l_target_bank);
		end if;
	end;

	procedure move_to_player_datapad (p_object_id objectid, p_target_player objectid, p_max_depth number)
	as
		l_target_datapad objectid;
	begin
		l_target_datapad := admin.get_datapad_for_player(p_target_player);

		if (l_target_datapad <> 0) then
			move_to_container_depth(p_object_id, l_target_datapad, p_target_player, p_max_depth);
		end if;

	exception
		when others then
			NULL;
	end;

	procedure move_to_container_depth (p_object_id objectid, p_target_container objectid, p_target_load_with objectid, p_max_depth number)
	as
	begin
		update objects
		set contained_by = p_target_container,
		load_with = p_target_load_with,
		x = 0,
		y = 0,
		z = 0,
		node_x = 0,
		node_z = 0
		where object_id = p_object_id;

		delete market_auctions
		where item_id = p_object_id;

		fix_load_with_depth(p_object_id, p_target_load_with, p_max_depth);
	end;

	procedure move_to_container (p_object_id objectid, p_target_container objectid, p_target_load_with objectid)
	as
	begin
		move_to_container_depth(p_object_id, p_target_container, p_target_load_with, -1);
	end;

	function get_inventory_for_player (p_player_id objectid) return objectid
	as
		result objectid;
	begin
		select object_id
		into result
		from objects
		where contained_by = p_player_id
		and object_template_id = 2007924155
		and deleted = 0;

		return result;

		exception when others then
			return 0;
	end;

	function get_bank_for_player (p_player_id objectid) return objectid
	as
		result objectid;
	begin
		select object_id
		into result
		from objects
		where contained_by = p_player_id
		and object_template_id = -172438875
		and deleted = 0;

		return result;

		exception when others then
			return 0;
	end;

	function get_datapad_for_player (p_player_id objectid) return objectid
	as
		result objectid;
	begin
		select object_id
		into result
		from objects
		where contained_by = p_player_id
		and object_template_id = -1783727815
		and deleted = 0;

		return result;

		exception when others then
			return 0;
	end;

	function get_player_for_player (p_player_id objectid) return objectid
	as
		result objectid;
	begin
		select object_id
		into result
		from objects
		where contained_by = p_player_id
		and object_template_id = -640104330
		and deleted = 0;

		return result;

		exception when others then
			return 0;
	end;

	function get_container_for_object (p_object_id objectid) return objectid
	as
		result objectid;
	begin
		select contained_by
			into result
			from objects
			where object_id = p_object_id;
		return result;
		exception when others then
			return 0;
	end;

	function get_object_template_id (p_object_id objectid) return number
	as
		result number;
	begin
		select object_template_id
		into result
		from objects
		where object_id = p_object_id;

		return result;

		exception when others then
			return 0;
	end;

	function restore_house (p_house_id objectid) return number -- 1=success, 2=no such object or not deleted
	-- result codes:
	--    1 = success
	--    2 = not a character or not deleted
	--    3 = database error
	as
		cells number;
	begin

		select count(*) into cells
		from objects
		where contained_by = p_house_id;

		if (cells = 0) then
			return 3;
		end if;

		update objects
		set deleted = 0, deleted_date = NULL, bank_balance = bank_balance + 1000 -- roughly 1 day maintenance
		where object_id = p_house_id
		and deleted <> 0;

		if (sql%rowcount <> 1) then
			return 2;
		end if;

		update tangible_objects
		set damage_taken = 0
		where object_id = p_house_id;

		update objects
		set deleted = 0, deleted_date = NULL
		where object_id in (
			select object_id
			from objects
			start with object_id = p_house_id
			connect by prior object_id = contained_by) and
                      deleted in (select reason_code
                                  from delete_reasons
                                  where tag in ('House', 'ContainerDeleted'));

		fix_load_with (p_house_id, p_house_id);

		return 1;

	exception
		when others then
			return 3;
	end;


	function restore_character (p_player_id objectid, p_name out varchar2, p_account out number, p_template_id out number) return number
	-- result codes:
	--    1 = success
	--    2 = not a character or not deleted
	--    3 = database error
	as
		character_reason number;
	begin
		select reason_code
		into character_reason
		from delete_reasons
		where tag='CharacterDeleted';

		begin
			select station_id, object_name, object_template_id
			into p_account, p_name, p_template_id
			from players p, objects o
			where p.character_object = p_player_id
			and o.object_id = p_player_id
			and o.object_id = p.character_object;
		exception
			when no_data_found then
				return 2;
		end;

		update objects
		set deleted = 0, deleted_date = NULL
		where object_id in (
			select object_id
			from objects
			start with object_id = p_player_id
			connect by prior object_id = contained_by
			and deleted = character_reason);

		return 1;

	exception
		when others then
			return 3;
	end;

	function undelete_item (p_item_id objectid) return number -- 1=success, 2=no such object or not deleted
	-- result codes:
	--    1 = success
	--    2 = not exist
	--    3 = database error
	--    4 = success, items needs to be loaded
        as
            cnt number;
            l_type_id number;
            l_name varchar2(4000);
            l_account number;
            l_template_id number;
            l_load_with number;
	    l_result number;
        begin
	    select count(*) into cnt
	    from objects
	    where object_id = p_item_id;

            if (cnt = 0) then
                return 2;
            end if;

            select count(*) into cnt
            from objects
            where object_id = p_item_id and (deleted <> 0 or deleted_date is not null);

            if (cnt = 0) then
                return 1;
            end if;

            select type_id into l_type_id
            from objects
            where object_id = p_item_id;

	    select count(*) into cnt
	    from players
	    where character_object = p_item_id;

            if (l_type_id = 1112885583) then
                -- 0x4255494f = 'BUIO', building objects
                l_result := restore_house(p_item_id);
		if (l_result = 1) then
		    return 4;
		else
		    return l_result;
		end if;
            else if (l_type_id = 1129465167 and cnt > 0) then
                -- 0x4352454f = 'CREO', creture objects and has a row in players table
		-- This is a player
                return restore_character(p_item_id, l_name, l_account, l_template_id);
                else
                    update objects
                    set deleted = 0, deleted_date = null
                    where object_id in (
                        select object_id
                                from objects
                                start with object_id = p_item_id
                                connect by prior object_id = contained_by);

                    -- find out the top most load_with
                    begin
                        select count(*) into cnt
                        from objects
                        where (contained_by = 0 or load_contents = 'N') and rownum = 1
                        start with object_id = p_item_id
                        connect by object_id = prior contained_by;

                        if (cnt > 0) then
                            select object_id into l_load_with
                            from objects
                            where (contained_by = 0 or load_contents = 'N') and rownum = 1
                            start with object_id = p_item_id
                            connect by object_id = prior contained_by;
                            fix_load_with(p_item_id, l_load_with);
                        else
                            fix_load_with(p_item_id, p_item_id);
                        end if;

                    exception
                        when others then
                                return 2;
                        end;
                end if;
            end if;
	    select count(*) into cnt
	    from objects
	    where object_id = p_item_id and
		  type_id in (1112885583,  -- BuildingObject
			      1212763727,  -- HarvesterInstallationObject
			      1229869903,  -- InstallationObject
			      1296649807); -- ManufactureInstallationObject
	    if (cnt = 0) then
		return 1;
	    else
		return 4;
	    end if;
        exception
            when others then
                return 2;
        end;

	/**
	 *  move an object to a player
	    parameters:
		p_object_id	item object id to move
		p_target_player	target player id
	    result:
		1:  success
		2:  cannot find player's inventory
		3:  object not found
		4:  unknown database error
		5:  object is a player

		if you add an item type here, also add it to ConsoleCommandParserObject::performParsing()
		6:  failed because object_template_id is  2007924155 (object/tangible/inventory/character_inventory.iff)
		7:  failed because object_template_id is -1436615854 (object/tangible/mission_bag/mission_bag.iff)
		8:  failed because object_template_id is -1783727815 (object/tangible/datapad/character_datapad.iff)
		9:  failed because object_template_id is -172438875  (object/tangible/bank/character_bank.iff)
		10: failed because object_template_id is  2131722719 (object/weapon/melee/unarmed/unarmed_default_player.iff)
		11: failed because object_template_id is -640104330  (object/player/player.iff)
		12: failed because object_template_id is -1388112109 (object/cell/cell.iff)
		13: failed because object_template_id is -1324492681 (object/tangible/inventory/vendor_inventory.iff)
		14: failed because direct parent is a datapad object.
		15: failed because object is a building object (has an entry in the building_objects table)
		16: failed because object is an installation object (has an entry in the installation_objects table)
		17: failed because object is a ship object (has an entry in the ship_objects table)
	 */
	function move_item_to_player (p_object_id objectid, p_target_player objectid) return number
	as
		l_target_inventory objectid;
		l_object_player objectid;
		l_object_template_id number;
		l_container_id number;
		l_container_template_id number;
		l_row_count number;
	begin
		l_object_template_id := admin.get_object_template_id(p_object_id);
		l_object_player := admin.get_player_for_player(p_object_id);
		l_target_inventory := admin.get_inventory_for_player(p_target_player);

		if (l_object_player <> 0) then
			return 5;
		end if;

		if (l_object_template_id = 2007924155) then
			return 6;
		end if;

		if (l_object_template_id = -1436615854) then
			return 7;
		end if;

		if (l_object_template_id = -1783727815) then
			return 8;
		end if;

		if (l_object_template_id = -172438875) then
			return 9;
		end if;

		if (l_object_template_id = 2131722719) then
			return 10;
		end if;

		if (l_object_template_id = -640104330) then
			return 11;
		end if;

		if (l_object_template_id = -1388112109) then
			return 12;
		end if;

		if (l_object_template_id = -1324492681) then
			return 13;
		end if;

		-- check to see if our parent is a datapad.

		l_container_id := admin.get_container_for_object(p_object_id);
		l_container_template_id := get_object_template_id(l_container_id);
		if (l_container_template_id = -1783727815) then
			return 14;
		end if;

		-- check to see if we are a building
		select count(*)
			into l_row_count
			from building_objects
			where object_id = p_object_id;
		if (l_row_count > 0) then
			return 15;
		end if;

		select count(*)
			into l_row_count
			from installation_objects
			where object_id = p_object_id;
		if (l_row_count > 0) then
			return 16;
		end if;

		-- check to see if we're trying to move a ship object.
		select count(*)
			into l_row_count
			from ship_objects
			where object_id = p_object_id;
		if (l_row_count >0) then
			return 17;
		end if;

		if (l_target_inventory <> 0) then
			update objects
			set contained_by = l_target_inventory,
			load_with = p_target_player,
			x = 0,
			y = 0,
			z = 0,
			node_x = 0,
			node_z = 0
			where object_id = p_object_id;
			if (sql%rowcount = 0) then
			    return 3;
			end if;
			delete market_auctions
			where item_id = p_object_id;
			fix_load_with(p_object_id, p_target_player);
		else
			return 2;
		end if;
		return 1;
	exception
		when others then
			return 4;
	end;

	/**
	 *  Fix the load_with values for anything contained by the specified object with a max depth or unlimited if max depth = -1
	 */
	procedure fix_load_with_depth (p_topmost_object objectid, p_starting_loadwith objectid, p_max_depth number) as
		oid_stack vaofnumber := vaofnumber(p_topmost_object);  -- objects to look at
		load_with_stack vaofnumber := vaofnumber(p_starting_loadwith); -- the load_with to inherit from these objects
		stack_top number := 1;
		parent_object number := 0;
		parent_load_with number := 0;
		current_load_with number := 0;
		inherit_load_with number := 0;
		stack_top_depth vaofnumber := vaofnumber(0); -- the depth of the object at the top of the stack
		current_depth number := 0;
		topmost_load_contents char(1) := '';
	begin
		-- Depth-first search

		update objects set load_with = p_starting_loadwith where object_id = p_topmost_object;

		-- if the first object being fixed is demand loaded, set child object load_with values to this object
		if (sql%rowcount = 1) then
			select load_contents into topmost_load_contents from objects where object_id = p_topmost_object;
			if (topmost_load_contents = 'N') then
				load_with_stack(stack_top) := p_topmost_object;
			end if;
		end if;

		while (stack_top <> 0) loop
			parent_object := oid_stack(stack_top);
			parent_load_with := load_with_stack(stack_top);
			current_depth := stack_top_depth(stack_top) + 1;
			stack_top := stack_top - 1;
			oid_stack.trim;
			load_with_stack.trim;

			-- keep adding children unless at max depth
			if (p_max_depth = -1 or current_depth <= p_max_depth) then
				for x in (select object_id, player_controlled, deleted, load_contents from objects where contained_by = parent_object) loop
					-- look at child objects and set their load_withs

					current_load_with := parent_load_with;
					inherit_load_with := parent_load_with;

					-- load_with defaults to the parent's load with, except in special cases:

					if (x.deleted <> 0 ) then -- deleted, load with is 0 for this and all its contents
						current_load_with := NULL;
						inherit_load_with := NULL;
					else
						if (x.player_controlled = 'Y') then -- player. load with = self for this and contents, even if container is deleted
							current_load_with := x.object_id;
							inherit_load_with := x.object_id;
						else
							if (x.load_contents = 'N' and current_load_with IS NOT NULL) then -- demand-load container.  contents get this as their load_with except if a parent is deleted
								inherit_load_with := x.object_id;
							end if;
						end if;
					end if;

					stack_top := stack_top + 1;
					oid_stack.extend;
					load_with_stack.extend;
					stack_top_depth.extend;
					oid_stack(stack_top) := x.object_id;
					load_with_stack(stack_top) := inherit_load_with;
					stack_top_depth(stack_top) := current_depth;

					update objects set load_with = current_load_with where object_id = x.object_id;
				end loop;
			end if;
		end loop;
	end;

	/**
	 *  Fix the load_with values for anything contained by the specified object
	 */
	procedure fix_load_with (p_topmost_object objectid, p_starting_loadwith objectid) as
	begin
		fix_load_with_depth(p_topmost_object, p_starting_loadwith, -1);
	end;

end;

/

  GRANT EXECUTE ON "SWG"."ADMIN" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body BIOGRAPHY
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."BIOGRAPHY" 
as
	procedure set_biography (p_owner objectid, p_biography varchar2)
	as

	m_enable_db_logging INTEGER := 0;

	begin
		if (p_biography is not null) then
			update biographies
			set biography = p_biography
			where object_id = p_owner;

			if (sql%rowcount = 0) then
				insert into biographies (object_id, biography)
				values (p_owner, p_biography);
			end if;
		else
			delete biographies
			where object_id = p_owner;
		end if;
	exception
		when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'biography.set_biography : update error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('biography.set_biography','objectid','number',p_owner);
						db_error_logger.dblogerror_values('biography.set_biography','biography','varchar2',p_biography);
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('biography','set_biography') = 1) THEN
					-- RAISE;
					NULL;
				END IF;
			end;
	end;

	function get_biography (p_owner objectid) return refcursor
	as
		rc refcursor;
	begin
		open rc for
		select biography
		from biographies
		where object_id = p_owner;

		return rc;
	end;
end;

/

  GRANT EXECUTE ON "SWG"."BIOGRAPHY" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body BLOB_DATA_CONVERSION
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."BLOB_DATA_CONVERSION" as

function blob_encodeoob_old(v_blob blob) return varchar2
is
	retstring varchar2(4000);
	b binary_integer;
begin
	if utl_raw.length(v_blob) > 1 then
		for i in 1..trunc(utl_raw.length(v_blob)/2) loop
			begin
				b := utl_raw.CAST_TO_BINARY_INTEGER(utl_raw.SUBSTR(v_blob,(i*2)-1,2),2);
				if b = 0 then
					retstring := retstring || chr(15712191) || chr(1);
				elsif b = 65535 then
					retstring := retstring || chr(15712191) || chr(2);
				elsif b = 27 then
					retstring := retstring || chr(15712191) || chr(3);
				elsif b > 2048 then -- 3-byte encoding
					retstring := retstring || chr(((224 + mod(trunc(b / 4096), 16)) * 65536) + ((128 + mod(trunc(b / 64),64)) * 256) + (128 + mod(b, 64)));
				elsif b > 127 then -- 2-byte encoding
					retstring := retstring || chr((mod(trunc(b / 64),32) + 192) * 256 + (mod(b, 64) + 128));
				else
					retstring := retstring || chr(b);
				end if;
			exception
				when others then
					retstring := retstring || ' ';
			end;
			exit when length(retstring) >= 3996;
		end loop;
		retstring := retstring || chr(15712191) || chr(4);
		return retstring;
	else
		return null;
	end if;
exception
	when others then
		return null;
end;

function blob_encodeoob(v_blob blob) return varchar2
is
	retstring varchar2(4000);
	b binary_integer;
    buf1 raw(10);
    buf2 raw(10);
    buf raw(10);
begin
	if utl_raw.length(v_blob) > 1 then
		for i in 1..trunc(utl_raw.length(v_blob)/2) loop
			b := utl_raw.CAST_TO_BINARY_INTEGER(utl_raw.SUBSTR(v_blob,(i*2)-1,2),2);
                	retstring := retstring || substr(to_char(b, '0XXXX'), 3);
       			exit when length(retstring) >= 3998;
		end loop;
		return retstring;
	else
		return null;
	end if;
exception
	when others then
	return null;
end;

function blob_hexdump(v_blob blob) return varchar2
is
	retstring varchar2(4000);
	b binary_integer;
begin
	if utl_raw.length(v_blob) > 0 then
		for i in 1..utl_raw.length(v_blob) loop
			b := utl_raw.CAST_TO_BINARY_INTEGER(utl_raw.SUBSTR(v_blob,i,1));
			retstring := retstring || to_char(b, '0x');
		end loop;
		return retstring;
	else
		return null;
	end if;
exception
	when others then
		return null;
end;


function blob_to_string(v_blob blob) return varchar2
is
	retstring varchar2(2000);
	c char;
	b binary_integer;
begin
	if utl_raw.length(v_blob) > 0 then
		-- assumes blob is in UTF16
		for i in 1..trunc(utl_raw.length(v_blob)/2) loop
			b := utl_raw.CAST_TO_BINARY_INTEGER(utl_raw.SUBSTR(v_blob,(i*2)-1,2),2);
			if b > 2048 then -- 3-byte encoding
				retstring := retstring || chr(((224 + mod(trunc(b / 4096), 16)) * 65536) + ((128 + mod(trunc(b / 64),64)) * 256) + (128 + mod(b, 64)));
			elsif b > 127 then -- 2-byte encoding
				retstring := retstring || chr((mod(trunc(b / 64),32) + 192) * 256 + (mod(b, 64) + 128));
			else
				retstring := retstring || chr(b);
			end if;
		end loop;
		return retstring;
	else
		return null;
	end if;
exception
	when others then
		return null;
end;


function string_hexdump(v_string varchar2) return varchar2
is
begin
	return blob_hexdump(utl_raw.CAST_TO_RAW(v_string));
exception
	when others then
		return null;
end;


procedure convert_blob_data(v_item_id number)
is
	i number;
begin
--	update market_auctions
--	set new_oob = blob_encodeoob(oob),
--	    new_item_name = blob_to_string(item_name),
--	    new_user_desc = blob_to_string(user_description)
--	where item_id = v_item_id;
--	commit;
	i := 0;
end;

end;

/

  GRANT EXECUTE ON "SWG"."BLOB_DATA_CONVERSION" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body CM_LOADER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."CM_LOADER" is

  FUNCTION get_location_list RETURN swg_cur
  IS

  swg_cur_out swg_cur;

  BEGIN
	-- Clean up orphaned vendors
	DELETE from Auction_Locations
	WHERE owner_id > 0 and not exists
	(select 1 from objects where object_id = location_id and deleted = 0);
	commit;

    OPEN swg_cur_out FOR
    SELECT location_id,
    	   owner_id,
           location_name,
           sales_tax,
           sales_tax_bank_id,
	   empty_date,
	   last_access_date,
	   inactive_date,
	   status,
	   search_enabled,
	   entrance_charge
    FROM auction_locations;

    RETURN swg_cur_out;

  END get_location_list;

  FUNCTION get_bid_list RETURN swg_cur
  IS

  swg_cur_out swg_cur;

  BEGIN
    OPEN swg_cur_out FOR
    SELECT item_id,
           bidder_id,
           bid,
           max_proxy_bid
    FROM market_auction_bids;

    RETURN swg_cur_out;

  END get_bid_list;

  FUNCTION get_auction_list RETURN swg_cur
  IS

  swg_cur_out swg_cur;

  BEGIN
    OPEN swg_cur_out FOR
    SELECT creator_id,
           min_bid,
           auction_timer,
           buy_now_price,
           user_description,
           oob,
           location_id,
           item_id,
           category,
           item_timer,
           item_name,
           owner_id,
           active,
           item_size,
           object_template_id
    FROM market_auctions WHERE object_template_id IS NOT NULL;

    RETURN swg_cur_out;

  END get_auction_list;

  FUNCTION get_auction_attributes RETURN swg_cur
  IS

  swg_cur_out swg_cur;

  BEGIN
    OPEN swg_cur_out FOR
    SELECT item_id,
           attribute_name,
           attribute_value
    FROM market_auction_attributes;

    RETURN swg_cur_out;

  END get_auction_attributes;
end cm_loader;

/

  GRANT EXECUTE ON "SWG"."CM_LOADER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body CM_PERSISTER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."CM_PERSISTER" 
as

	procedure update_auction_locations (p_location_id VAOFSTRING,
					 p_location_name VAOFSTRING,
					 p_owner_id VAOFSTRING,
					 p_sales_tax VAOFNUMBER,
					 p_sales_tax_bank_id VAOFSTRING,
					 p_empty_date VAOFNUMBER,
					 p_last_access_date VAOFNUMBER,
					 p_inactive_date VAOFNUMBER,
					 p_status VAOFNUMBER,
					 p_search_enabled VAOFSTRING,
					 p_entrance_charge VAOFNUMBER,
					 p_chunk_size number)
	as
		errors number;
		dml_errors EXCEPTION;
		PRAGMA exception_init(dml_errors, -24381);
	begin
		FORALL i in 1..p_chunk_size save exceptions
			UPDATE AUCTION_LOCATIONS Set
				location_name = DECODE(p_location_name(i), NULL, location_name, p_location_name(i)),
				owner_id = DECODE(p_owner_id(i), NULL, owner_id, p_owner_id(i)),
				sales_tax = DECODE(p_sales_tax(i), NULL, sales_tax, p_sales_tax(i)),
				sales_tax_bank_id = DECODE(p_sales_tax_bank_id(i), NULL, sales_tax_bank_id, p_sales_tax_bank_id(i)),
				empty_date = DECODE(p_empty_date(i), NULL, empty_date, p_empty_date(i)),
				last_access_date = DECODE(p_last_access_date(i), NULL, last_access_date, p_last_access_date(i)),
				inactive_date = DECODE(p_inactive_date(i), NULL, inactive_date, p_inactive_date(i)),
				status = DECODE(p_status(i), NULL, status, p_status(i)),
				search_enabled = DECODE(p_search_enabled(i), NULL, search_enabled, p_search_enabled(i)),
				entrance_charge = DECODE(p_entrance_charge(i), NULL, entrance_charge, p_entrance_charge(i))
			WHERE
				location_id = p_location_id(i);
		exception
			when dml_errors then
				errors := SQL%BULK_EXCEPTIONS.count;
	end;

	procedure insert_auction_locations (p_location_id VAOFSTRING,
					 p_location_name VAOFSTRING,
					 p_owner_id VAOFSTRING,
					 p_sales_tax VAOFNUMBER,
					 p_sales_tax_bank_id VAOFSTRING,
					 p_empty_date VAOFNUMBER,
					 p_last_access_date VAOFNUMBER,
					 p_inactive_date VAOFNUMBER,
					 p_status VAOFNUMBER,
					 p_search_enabled VAOFSTRING,
					 p_entrance_charge VAOFNUMBER,
					 p_chunk_size number)
	as
		errors number;
		k number;
		dml_errors EXCEPTION;
		PRAGMA exception_init(dml_errors, -24381);
	begin
		FORALL i in 1..p_chunk_size save exceptions
			INSERT into auction_locations (
				location_id,
				location_name,
				owner_id,
				sales_tax,
				sales_tax_bank_id,
				empty_date,
				last_access_date,
				inactive_date,
				status,
				search_enabled,
				entrance_charge )
			VALUES (
				p_location_id(i),
				p_location_name(i),
				p_owner_id(i),
				p_sales_tax(i),
				p_sales_tax_bank_id(i),
				p_empty_date(i),
				p_last_access_date(i),
				p_inactive_date(i),
				p_status(i),
				p_search_enabled(i),
				p_entrance_charge(i) );
		exception
			when dml_errors then
				errors := SQL%BULK_EXCEPTIONS.count;
				for j in 1..errors loop
					k := SQL%BULK_EXCEPTIONS(j).ERROR_INDEX;
					UPDATE auction_locations Set
						location_name = p_location_name(k),
						owner_id = p_owner_id(k),
						sales_tax = p_sales_tax(k),
						sales_tax_bank_id = p_sales_tax_bank_id(k),
						empty_date = p_empty_date(k),
						last_access_date = p_last_access_date(k),
						inactive_date = p_inactive_date(k),
						status = p_status(k),
						search_enabled = p_search_enabled(k),
						entrance_charge = p_entrance_charge(k)
					WHERE
						location_id = p_location_id(k);
				end loop;
	end;

	procedure delete_auction_locations (p_location_id VAOFSTRING, p_chunk_size number)
	as
		errors number;
		dml_errors EXCEPTION;
		PRAGMA exception_init(dml_errors, -24381);
	begin
		FORALL i in 1..p_chunk_size save exceptions
			delete from auction_locations
			where location_id = p_location_id(i);
		exception
			when dml_errors then
				errors := SQL%BULK_EXCEPTIONS.count;
	end;

	procedure insert_market_auction_bids (p_item_id VAOFSTRING,
					 p_bidder_id VAOFSTRING,
					 p_bid VAOFNUMBER,
					 p_max_proxy_bid VAOFNUMBER,
					 p_chunk_size number)
	as
		errors number;
		k number;
		dml_errors EXCEPTION;
		PRAGMA exception_init(dml_errors, -24381);
	begin
		FORALL i in 1..p_chunk_size save exceptions
			INSERT into market_auction_bids (
				item_id,
				bidder_id,
				bid,
				max_proxy_bid )
			VALUES (
				p_item_id(i),
				p_bidder_id(i),
				p_bid(i),
				p_max_proxy_bid(i) );
		exception
			when dml_errors then
				errors := SQL%BULK_EXCEPTIONS.count;
				for j in 1..errors loop
					k := SQL%BULK_EXCEPTIONS(j).ERROR_INDEX;
					UPDATE market_auction_bids Set
						bidder_id = p_bidder_id(k),
						bid = p_bid(k),
						max_proxy_bid = p_max_proxy_bid(k)
					WHERE
						item_id = p_item_id(k);
				end loop;
	end;

	procedure update_market_auctions (p_item_id VAOFSTRING,
					 p_owner_id VAOFSTRING,
					 p_active VAOFNUMBER,
					 p_chunk_size number)
	as
		errors number;
		dml_errors EXCEPTION;
		PRAGMA exception_init(dml_errors, -24381);
	begin
		FORALL i in 1..p_chunk_size save exceptions
			UPDATE market_auctions Set
				owner_id = DECODE(p_owner_id(i), NULL, owner_id, p_owner_id(i)),
				active = DECODE(p_active(i), NULL, active, p_active(i))
			WHERE
				item_id = p_item_id(i);
		exception
			when dml_errors then
				errors := SQL%BULK_EXCEPTIONS.count;
	end;

	procedure insert_market_auctions (p_item_id VAOFSTRING,
					 p_owner_id VAOFSTRING,
					 p_creator_id VAOFSTRING,
					 p_location_id VAOFSTRING,
					 p_min_bid VAOFNUMBER,
					 p_buy_now_price VAOFNUMBER,
					 p_auction_timer VAOFNUMBER,
					 p_oob VAOFLONGSTRING,
					 p_user_description VAOFLONGSTRING,
					 p_category VAOFNUMBER,
					 p_item_name VAOFLONGSTRING,
					 p_item_timer VAOFNUMBER,
					 p_active VAOFNUMBER,
					 p_item_size VAOFNUMBER,
					 p_object_template_id VAOFNUMBER,
					 p_chunk_size number)
	as
		errors number;
		k number;
		dml_errors EXCEPTION;
		PRAGMA exception_init(dml_errors, -24381);
	begin
		FORALL i in 1..p_chunk_size save exceptions
			INSERT into market_auctions (
				item_id,
				owner_id,
				creator_id,
				location_id,
				min_bid,
				buy_now_price,
				auction_timer,
				oob,
				user_description,
				category,
				item_name,
				item_timer,
				active,
				item_size,
				object_template_id )
			VALUES (
				p_item_id(i),
				p_owner_id(i),
				p_creator_id(i),
				p_location_id(i),
				p_min_bid(i),
				p_buy_now_price(i),
				p_auction_timer(i),
				p_oob(i),
				p_user_description(i),
				p_category(i),
				p_item_name(i),
				p_item_timer(i),
				p_active(i),
				p_item_size(i),
				p_object_template_id(i) );
	exception
		when dml_errors then
			errors := SQL%BULK_EXCEPTIONS.count;
			for j in 1..errors loop
				k := SQL%BULK_EXCEPTIONS(j).ERROR_INDEX;
				UPDATE market_auctions Set
					owner_id = p_owner_id(k),
					creator_id = p_creator_id(k),
					location_id = p_location_id(k),
					min_bid = p_min_bid(k),
					buy_now_price = p_buy_now_price(k),
					auction_timer = p_auction_timer(k),
					oob = p_oob(k),
					user_description = p_user_description(k),
					category = p_category(k),
					item_name = p_item_name(k),
					item_timer = p_item_timer(k),
					active = p_active(k),
					item_size = p_item_size(k),
					object_template_id = p_object_template_id(k)
				WHERE
					item_id = p_item_id(k);
			end loop;
	end;

	procedure delete_market_auctions (p_item_id VAOFSTRING, p_chunk_size number)
	as
		errors number;
		dml_errors EXCEPTION;
		PRAGMA exception_init(dml_errors, -24381);
	begin
		FORALL i in 1..p_chunk_size save exceptions
			delete from market_auction_attributes
			where item_id = p_item_id(i);

		FORALL i in 1..p_chunk_size save exceptions
			delete from market_auctions
			where item_id = p_item_id(i);
		--exception
			--when dml_errors then
				--errors := SQL%BULK_EXCEPTIONS.count;
	end;

	procedure insert_auction_attributes (p_item_id VAOFSTRING, p_attribute_name VAOFSTRING, p_attribute_value VAOFSTRING, p_chunk_size number)
	as
		dml_errors EXCEPTION;
		PRAGMA exception_init(dml_errors, -24381);
	begin
		FORALL i in 1..p_chunk_size save exceptions
			insert into market_auction_attributes (item_id, attribute_name, attribute_value)
			values (p_item_id(i), p_attribute_name(i), p_attribute_value(i));
		exception when dml_errors then
			null;
	end;
end;

/

  GRANT EXECUTE ON "SWG"."CM_PERSISTER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body CUSTSERV_PROCS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."CUSTSERV_PROCS" 
as

	function get_characters_for_account
	(
	station_id_in IN players.station_id%TYPE
	)
	return cursortype
	is
		result cursortype;
	begin
		open result for
		select
			character_object, uc_character_name
		from
			players
		where
			station_id = station_id_in;
		return result;
	end get_characters_for_account;

	function get_deleted_items
	(
	character_id_in IN objects.load_with%TYPE,
	start_page_in IN number
	)
	return cursortype
	is
		result cursortype;
	begin
		open result for
		select * from
			(select a.*, rownum RN from
			( select
			o.object_id, name_string_table, name_string_text, object_name
			from objects o,
				(select object_id from objects where contained_by = character_id_in and object_template_id = -1783727815) datapad,
				(select object_id from tangible_objects where owner_id = character_id_in) tangibles
		where
			( deleted > 0 )
			and ( o.object_id = tangibles.object_id
			    or contained_by = datapad.object_id)
			    order by deleted_date desc ) a
				where rownum <= start_page_in * 20 + 20)
			where rn >= start_page_in * 20;
		return result;
	end get_deleted_items;

	function get_structures
	(
		character_id_in IN objects.object_id%TYPE
	)
	return cursortype
	is
		result cursortype;
	begin
		open result for
		select o.object_id as object_id,
			o.x as x,
			o.y as y,
			o.z as z,
			o.scene_id as scene_id,
			o.name_string_text as object_template,
			o.deleted as deleted
		from objects o, tangible_objects tan
		where tan.owner_id = character_id_in
			and tan.object_id = o.object_id
				and ( (o.object_id in (select object_id from building_objects ) )
					or ( o.object_id in (select object_id from installation_objects) ) );
		return result;
	end get_structures;

	function get_player_id
	(
		character_name_in IN players.uc_character_name%TYPE
	)
	return cursortype
	is
		result cursortype;
	begin
		open result for
		select character_object, station_id
		from players
		where upper(uc_character_name) = upper(character_name_in);
	return result;
	end get_player_id;

	procedure move_player
	(
		character_id_in IN objects.object_id%TYPE,
		x_in IN objects.x%TYPE,
		y_in IN objects.y%TYPE,
		z_in IN objects.z%TYPE,
		scene_in IN objects.scene_id%TYPE
	)
	as
	begin
		update objects
			set x = x_in,
			    y = y_in,
			    z = z_in,
			    scene_id = scene_in
			where object_id = character_id_in;
	end move_player;

	procedure undelete_item
	(
		character_id_in IN objects.object_id%TYPE,
		object_in IN objects.object_id%TYPE,
		move_in IN number
	)
	as
		restore_result number;
	begin
		restore_result := admin.undelete_item(object_in);
		if ((restore_result != 1) and (restore_result != 4)) then
			return;
		end if;

		if (move_in > 0) then
			restore_result := admin.move_item_to_player(object_in, character_id_in);
		end if;
		return;
	exception
		when others then
			return;
	end undelete_item;

end custserv_procs;

/

  GRANT EXECUTE ON "SWG"."CUSTSERV_PROCS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body DATALOOKUP
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."DATALOOKUP" 
as

	function check_character_name(p_name varchar2) return number as
		obj_id number;
	begin
		select character_object
		into obj_id
		from players
		where uc_character_name = p_name;

		if (obj_id is null) then
			return 0;
		else
			return 1;
		end if;

	exception
		when no_data_found then
			return 0;

		when too_many_rows then
			return 1;
	end;

	function get_structures_for_purge(p_station_id number) return refcursor
	as
		result_cursor refcursor;
	begin
		open result_cursor for
		select o.object_id, t.owner_id
		from players p, tangible_objects t, objects o
		where p.station_id = p_station_id
		and p.character_object = t.owner_id
		and t.object_id = o.object_id
		and o.contained_by = 0
		and o.deleted = 0
		and o.type_id in (1112885583, 1212763727, 1296649807) --house, harvester, factory
		-- exclude city halls and faction hqs
		and o.object_template_id not in
		(2104917241, -1402078881, -1650739949, 1078805016, -1085193189, -2036447549,
		-1503538066, 1083153409, -1889839602, 2103485856, -1318727266, -447776542,
		-278088733, 456016075, 2103180392, -1782254683, 1221154416, 943757712,
		344955127, -1651881206, -1428516812, 121334480, -1391658348, 585958560,
		1568866170, -970221632, 1490696786, -274776875, 1419804026, -1907246,
		-714325274, -2102543938, -382786695);

		return result_cursor;
	end;

	function get_vendors_for_purge(p_station_id number) return refcursor
	as
		result_cursor refcursor;
	begin
		open result_cursor for
		-- get all vendors owned by this station_id
		select o.object_id, t.owner_id, o.object_name
		from players p, tangible_objects t, objects o
		where p.station_id = p_station_id
		and p.character_object = t.owner_id
		and t.object_id = o.object_id
		and o.deleted = 0
		and o.script_list like '%terminal.vendor:%'

		union
		-- plus all vendors in purge structures owned by this station_id
		select t.object_id, t.owner_id, o.object_name
		from tangible_objects t, objects o
		where t.object_id in
		(
		select object_id
		from objects
		where deleted = 0
		and script_list like '%terminal.vendor:%'
		start with object_id in
		(
			select o.object_id
			from players p, tangible_objects t, objects o
		where p.station_id = p_station_id
		and p.character_object = t.owner_id
		and t.object_id = o.object_id
		and o.deleted = 0
			and o.type_id in (1112885583, 1212763727, 1296649807) --house, harvester, factory
			-- exclude city halls and faction hqs
			and o.object_template_id not in
			(2104917241, -1402078881, -1650739949, 1078805016, -1085193189, -2036447549,
			-1503538066, 1083153409, -1889839602, 2103485856, -1318727266, -447776542,
			-278088733, 456016075, 2103180392, -1782254683, 1221154416, 943757712,
			344955127, -1651881206, -1428516812, 121334480, -1391658348, 585958560,
			1568866170, -970221632, 1490696786, -274776875, 1419804026, -1907246,
			-714325274, -2102543938, -382786695)
		)
			connect by contained_by = prior object_id
		) and t.object_id = o.object_id;

		return result_cursor;
	end;
end;

/

  GRANT EXECUTE ON "SWG"."DATALOOKUP" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body DATA_CLEANUP
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."DATA_CLEANUP" 
as
	procedure run_cleanup as
	begin
		delete messages
		where not exists (
			select 1 from objects
			where objects.object_id = messages.target);
	end;

	procedure run_fix_bad_cells as

		v_count PLS_INTEGER := 0;

	begin

	FOR x IN
	(
		SELECT * from
		(
			SELECT a.object_id, a.contained_by, a.load_with, a.deleted,
			(select contained_by from objects where object_id = a.contained_by) contained_by_value
			FROM objects a, cell_objects b
			WHERE a.object_id = b.object_id
		)
		where contained_by_value = 0 and
		contained_by != load_with
	)
	LOOP

	UPDATE objects
	SET load_with = x.contained_by
	where object_id = x.object_id;

	v_count := v_count + 1;
	IF (MOD(v_count, 1000) = 0) then
		COMMIT;
	END IF;

	END LOOP;

	COMMIT;

	run_fix_houses_w_bad_cells;

	end;

	procedure run_fix_houses_w_bad_cells as

		v_count PLS_INTEGER := 0;
		v_last_contained_by NUMBER := -1;
		v_current_contained_by NUMBER := 0;
		v_retval NUMBER;

	begin

	FOR x IN
	(
		select o1.object_id, o1.contained_by
		from cell_objects c, objects o1, objects o2
		where c.object_id = o1.object_id
		and o1.deleted > 0
		and o2.object_id = o1.contained_by
		and o2.deleted = 0
		order by o1.contained_by
	)
	LOOP

	v_current_contained_by := x.contained_by;

	UPDATE objects
	SET deleted = 13,
	deleted_date = SYSDATE + 100
	where object_id = x.object_id;

	IF (((v_current_contained_by != v_last_contained_by) and v_last_contained_by >=0)) THEN

		UPDATE objects
		SET deleted = 13,
		deleted_date = SYSDATE + 100
		where object_id = v_last_contained_by;

		v_retval := admin.restore_house (v_last_contained_by);
		-- result codes:
		--    1 = success
		--    2 = not a character or not deleted
		--    3 = database error


	END IF;


	v_count := v_count + 1;
	IF (MOD(v_count, 1000) = 0) then
		COMMIT;
	END IF;

	v_last_contained_by := v_current_contained_by;

	END LOOP;

		UPDATE objects
		SET deleted = 13,
		deleted_date = SYSDATE + 100
		where object_id = v_last_contained_by;

		v_retval := admin.restore_house (v_last_contained_by);


	COMMIT;

	end;

	function getObjectsWithExpMessages return cursortype as
		result_cursor cursortype;
	begin
		open result_cursor for
			select target from messages where method='C++experience' group by target having count(*) > 100 order by count(*) desc;

		return result_cursor;
	end;

	function getExperienceGrants(p_object_id objectid) return cursortype as
		result_cursor cursortype;
	begin
		open result_cursor for
			select data from messages where target=p_object_id and method='C++experience';

		return result_cursor;
	end;

	procedure delete_experience(p_object_id objectid) as
	begin
		delete messages where target=p_object_id and method='C++experience';
	end;

	procedure grant_experience(p_object_id objectid, p_experience_data varchar2) as
	begin
		insert into messages (message_id, target, method, data, call_time, guaranteed, delivery_type)
		values (objectidmanager.get_single_id(), p_object_id, 'C++experience', p_experience_data, 0, 'Y', 0);
	end;






   -- Delete 10,000 unused object variables at a time
   function object_variable_name_cleanup return number
   as
   begin
       delete from object_variable_names where id not in (select name_id from object_variables group by name_id) and rownum < 10000;
       commit;
       return sql%rowcount;
    end;



   -- Delete 25,000 orphaned rows at a time
   function orphaned_object_cleanup return number
   as
   begin
       update objects set deleted = 7 where contained_by != 0 and contained_by not in (select object_id from objects) and deleted = 0 and rownum < 25000;
       commit;
       return sql%rowcount;
    end;


   -- Delete 10,000 orphaned attribute rows at a time
   function market_attributes_cleanup return number
   as
   begin
       delete from market_auction_attributes where market_auction_attributes.ITEM_ID not in (select market_auctions.ITEM_ID from market_auctions group by market_auctions.ITEM_ID) and rownum < 10000;
       commit;
       return sql%rowcount;
    end;


   -- Delete 50,000 orphaned message rows at a time
   function messages_cleanup return number
   as
   begin

      delete messages
      where not exists (
         select 1 from objects
         where objects.object_id = messages.target) and rownum < 50000;
       commit;
       return sql%rowcount;
    end;


   -- Delete 25,000 orphaned vendor object rows at a time
   function vendor_object_cleanup return number
   as
   begin
       update objects set deleted = 9 where
         deleted = 0
         and
         object_id not in (select item_id from market_auctions)
         and
         contained_by in (select object_id from objects where script_list like '%terminal.vendor:%')
         and
         rownum < 25000;

         commit;
         return sql%rowcount;
    end;




   -- Delete 10,000 broken object rows at a time
   function broken_object_cleanup return number
   as
   numrows number;
   begin
      numrows := 0;


      delete from building_objects where not exists ( select 1 from objects where objects.object_id = building_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

       delete from cell_objects where not exists ( select 1 from objects where objects.object_id = cell_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

       delete from city_objects where not exists ( select 1 from objects where objects.object_id = city_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from creature_objects where not exists ( select 1 from objects where objects.object_id = creature_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from factory_objects where not exists ( select 1 from objects where objects.object_id = factory_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from harvester_installation_objects where not exists ( select 1 from objects where objects.object_id = harvester_installation_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from installation_objects where not exists ( select 1 from objects where objects.object_id = installation_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from intangible_objects where not exists ( select 1 from objects where objects.object_id = intangible_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from manf_schematic_objects where not exists ( select 1 from objects where objects.object_id = manf_schematic_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from manufacture_inst_objects where not exists ( select 1 from objects where objects.object_id = manufacture_inst_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from mission_objects where not exists ( select 1 from objects where objects.object_id = mission_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from planet_objects where not exists ( select 1 from objects where objects.object_id = planet_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

       delete from player_objects where not exists ( select 1 from objects where objects.object_id = player_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

       delete from ship_objects where not exists ( select 1 from objects where objects.object_id = ship_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from static_objects where not exists ( select 1 from objects where objects.object_id = static_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

       delete from tangible_objects where not exists ( select 1 from objects where objects.object_id = tangible_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from token_objects where not exists ( select 1 from objects where objects.object_id = token_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from universe_objects where not exists ( select 1 from objects where objects.object_id = universe_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

      delete from vehicle_objects where not exists ( select 1 from objects where objects.object_id = vehicle_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

       delete from weapon_objects where not exists ( select 1 from objects where objects.object_id = weapon_objects.object_id ) and rownum < 10000;
       commit;
      numrows := numrows + sql%rowcount;

       return numrows;
    end;


end;

/

  GRANT EXECUTE ON "SWG"."DATA_CLEANUP" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body DB_ERROR_LOGGER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."DB_ERROR_LOGGER" 
    as
  procedure dblogerror( p_ora_errno number, p_notes varchar2 default NULL)
  as

  PRAGMA AUTONOMOUS_TRANSACTION;

  v_ora_errmsg varchar2(255);
  v_schema varchar2(30);
  v_module varchar2(80);
  v_notes  varchar2(4000);

  begin

    v_ora_errmsg := SQLERRM(p_ora_errno);
    stack_search(2, v_schema, v_module);

    if length(p_notes) > 4000 then
    	v_notes := substr(p_notes,1,4000);
    else
    	v_notes := p_notes;
    end if;

    insert into errorlog
    ( error_id,
      ora_errno,
      ora_errmsg,
      schema_name,
      module_name,
      notes )
    values
    ( seq_errorlog.nextval,
      p_ora_errno,
      v_ora_errmsg,
      v_schema,
      v_module,
      v_notes );

      COMMIT;

  exception
  	when others then
		NULL;
  end;

  procedure dblogerror_values( p_owner varchar2, p_name varchar2, p_type varchar2, p_value varchar2)
  as

  PRAGMA AUTONOMOUS_TRANSACTION;
  v_value  varchar2(4000);

  begin

    if length(p_value) > 4000 then
    	v_value := substr(p_value,1,4000);
    else
    	v_value := p_value;
    end if;

    insert into errorlog_values
    ( error_id,
      element_owner,
      element_name,
      element_type,
      element_value )
    values
    ( seq_errorlog.currval,
      p_owner,
      p_name,
      p_type,
      v_value );

      COMMIT;

  exception
  	when others then
		NULL;

  end;

  procedure stack_search ( i_search in  integer, o_schema out varchar2, o_module out varchar2 )
  -----
  -- Returns the schema and module of the specified stack level
  -- (specified by i_search). Stack level 0 is this proc.
  -- Stack level 1 is this proc's caller. Level 2 is THEIR
  -- caller. And so on.
  -----
  as
    call_stack varchar2(4096) default dbms_utility.format_call_stack;
    n number;
    m_found_stack boolean default false;
    m_line varchar2(255);
    m_count number := 0;
            m_start integer := 1;
            m_end integer := -1;
  begin
            o_schema := 'Not found';
            o_module := 'Not found';
    loop
        m_end := instr( call_stack, chr(10), m_start );
        exit when ( m_count > i_search or m_end is NULL or m_end = 0 );
        m_line := ltrim(substr( call_stack, m_start + 20, m_end - (m_start + 20 )));
        m_start := m_end + 1;
                        -- Remove formatted stack header
        if ( NOT m_found_stack ) then
            if ( m_line like 'name%' ) then
                m_found_stack := TRUE;
            end if;
        else
            if ( m_count = i_search ) then
                if ( m_line like 'pr%' ) then
                    n := length( 'procedure ' );
                elsif ( m_line like 'fun%' ) then
                    n := length( 'function ' );
                elsif ( m_line like 'package body%' ) then
                    n := length( 'package body ' );
                elsif ( m_line like 'pack%' ) then
                    n := length( 'package ' );
                else
                    n := length( 'anonymous block ' );
                end if;
                m_line := substr( m_line, n );
                n := instr( m_line, '.' );
                o_schema := ltrim(rtrim(substr( m_line, 1, n-1 )));
                o_module := ltrim(rtrim(substr( m_line, n+1 )));
            end if;
            m_count := m_count + 1;
        end if;
    end loop;
end stack_search;

  function getloglevel
  RETURN INTEGER
  as

  	m_level INTEGER;

  begin

  	select levelid
	into m_level
	from errorlog_level;

	return m_level;

  exception
  	when others then
	  return 0;

  end getloglevel;


function reraisecheck ( p_package varchar2 default NULL, p_procedure varchar2 default NULL)
return INTEGER
as

PRAGMA AUTONOMOUS_TRANSACTION;

	m_unlimited_errors INTEGER;
	m_errorlimit INTEGER;
	m_errorcount INTEGER;
begin

  if (p_package IS NULL or p_procedure IS NULL) then
  	return 1;
  else
  	update errorlog_reraise_limits
  	set errorcount = errorcount + 1
  	where package = p_package and
  	procedure = p_procedure;

  	commit;

  	if (sql%rowcount = 0)  then
  		return 1;
  	else
  		select unlimited_flag, errorlimit, errorcount
  		into m_unlimited_errors, m_errorlimit, m_errorcount
  		from errorlog_reraise_limits
  		where package = p_package and
  		procedure = p_procedure;

  		if (m_unlimited_errors = 1) then
  			return 0;
  		else
  		  if (m_errorcount <= m_errorlimit) then
  		  	return 0;
  		  end if;
  		end if;
  	end if;
  end if;



  return 1;

exception
  when others then
  	return 1;

end reraisecheck;

end;

/

  GRANT EXECUTE ON "SWG"."DB_ERROR_LOGGER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body GOLD_OVERRIDE
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."GOLD_OVERRIDE" as

	function load_objvar_overrides(p_schema varchar2) return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			'select /*+ ORDERED USE_NL(T)*/ ' ||
			't.object_id, t.name_id, t.type, t.value ' ||
			'from ' ||
				p_schema || 'object_list l, ' ||
				'object_variables t ' ||
			'where l.object_id = t.object_id ' ||
			'and nvl(t.detached,0) = 0';

		return result_cursor;
	end;

end;

/

  GRANT EXECUTE ON "SWG"."GOLD_OVERRIDE" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body LAZY_DELETER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."LAZY_DELETER" as

	procedure purge_one_object (object_in in number) as
	BEGIN
		DELETE FROM armor WHERE object_id = object_in;
		DELETE FROM battlefield_marker_objects WHERE object_id = object_in;
		DELETE FROM battlefield_participants WHERE region_object_id = object_in;
		DELETE FROM battlefield_participants WHERE character_object_id = object_in;
		DELETE FROM biographies WHERE object_id = object_in;
		DELETE FROM building_objects WHERE object_id = object_in;
		DELETE FROM cell_objects WHERE object_id = object_in;
		DELETE FROM city_objects WHERE object_id = object_in;
		DELETE FROM creature_objects WHERE object_id = object_in;
		DELETE FROM experience_points WHERE object_id = object_in;
		DELETE FROM factory_objects WHERE object_id = object_in;
		DELETE FROM guild_objects WHERE object_id = object_in;
		DELETE FROM harvester_installation_objects WHERE object_id = object_in;
		DELETE FROM installation_objects WHERE object_id = object_in;
		DELETE FROM intangible_objects WHERE object_id = object_in;
		DELETE FROM location_lists WHERE object_id = object_in;
		DELETE FROM manf_schematic_attributes WHERE object_id = object_in;
		DELETE FROM manf_schematic_objects WHERE object_id = object_in;
		DELETE FROM manufacture_inst_objects WHERE object_id = object_in;
		DELETE FROM mission_objects WHERE object_id = object_in;
		DELETE FROM object_variables WHERE object_id = object_in;
		DELETE FROM planet_objects WHERE object_id = object_in;
		DELETE FROM player_objects WHERE object_id = object_in;
		DELETE FROM player_quest_objects WHERE object_id = object_in;
		DELETE FROM property_lists WHERE object_id = object_in;
		DELETE FROM resource_container_objects WHERE object_id = object_in;
		DELETE FROM scripts WHERE object_id = object_in;
		DELETE FROM ship_objects WHERE object_id = object_in;
		DELETE FROM static_objects WHERE object_id = object_in;
		DELETE FROM swg_characters WHERE object_id = object_in;
		DELETE FROM tangible_objects WHERE object_id = object_in;
		DELETE FROM temp_characters WHERE object_id = object_in;
		DELETE FROM token_objects WHERE object_id = object_in;
		DELETE FROM universe_objects WHERE object_id = object_in;
		DELETE FROM vehicle_objects WHERE object_id = object_in;
		DELETE FROM waypoints WHERE object_id = object_in;
		DELETE FROM weapon_objects WHERE object_id = object_in;
		DELETE FROM messages WHERE target = object_in;
		DELETE FROM objects WHERE object_id = object_in;
	END purge_one_object;

	procedure purge_objects_bulk(p_object_id VAOFSTRING, p_chunk_size number, p_enable_db_logging number )
	as

	errors	NUMBER;

	begin

	  	FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM armor WHERE object_id = p_object_id(i);
	  	FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM battlefield_marker_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM battlefield_participants WHERE region_object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM battlefield_participants WHERE character_object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM biographies WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM building_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM cell_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM city_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM creature_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM experience_points WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM factory_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM guild_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM harvester_installation_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM installation_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM intangible_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM location_lists WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM manf_schematic_attributes WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM manf_schematic_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM manufacture_inst_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM mission_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM object_variables WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM planet_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM player_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM player_quest_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM property_lists WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM resource_container_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM scripts WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM static_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM swg_characters WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM tangible_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM temp_characters WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM token_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM universe_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM vehicle_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM waypoints WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM weapon_objects WHERE object_id = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM messages WHERE target = p_object_id(i);
		FORALL i in 1..p_chunk_size SAVE EXCEPTIONS DELETE FROM objects WHERE object_id = p_object_id(i);

		exception when others then
			if ( p_enable_db_logging > 0 ) then
				errors:=SQL%BULK_EXCEPTIONS.COUNT;
				FOR x IN 1..errors LOOP
					db_error_logger.dblogerror( -SQL%BULK_EXCEPTIONS(x).ERROR_CODE, 'procedure purge_objects_bulk: error occurred in FORALL DELETE during iteration: ' || SQL%BULK_EXCEPTIONS(x).ERROR_INDEX );
						if ( p_enable_db_logging > 1 ) then
								db_error_logger.dblogerror_values( 'lazy deleter', 'object_id' , 'number', p_object_id(to_number(SQL%BULK_EXCEPTIONS(x).ERROR_INDEX)));
						end if;
				END LOOP;

			else
				NULL;
			end if;

	end;

end lazy_deleter;

/

  GRANT EXECUTE ON "SWG"."LAZY_DELETER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body LOADER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."LOADER" as

	procedure get_version_number(current_version in out number, min_version in out number)
	as
	begin
		select version_number, min_version_number
		into current_version, min_version
		from version_number;
	end;

	function get_character_name_list return cursortype
	as
		result_cursor cursortype;
	begin
		-- free up names that aren't in use anymore
		delete from players
		where not exists (select 1 from objects where objects.object_id = character_object);

		open result_cursor for
		select character_object, station_id, uc_character_name, character_full_name,
                       (create_time - to_date('01/01/1970', 'MM/DD/YYYY')) * 24 * 3600,
                       (last_login_time - to_date('01/01/1970', 'MM/DD/YYYY')) * 24 * 3600
		from players;

		return result_cursor;
	end;

	function locate_player (p_object_id number) return number
	as
	begin
		insert into object_list (object_id, container_level)
		select object_id, 100
		from objects
		where load_with = p_object_id and deleted = 0;

		return sql%rowcount;
	end;

	procedure locate_universe
	as
	begin
		insert into object_list (object_id)
		select o.object_id
		from objects o, universe_objects u
		where o.object_id = u.object_id
		and o.deleted=0;
	end;

	procedure locate_contained_object (p_container_id number, p_object_id number)
	as
	begin
		insert into object_list (object_id, container_level)
		select object_id, 100
		from objects o
		start with
			o.object_id = p_object_id
			and o.contained_by = p_container_id
			and o.deleted = 0
		connect by
			prior o.object_id = o.contained_by
			and o.deleted = 0;
	end;

	function locate_by_loadwith_batch (p_loadwiths vaofstring, p_chunk_size number)
	return number
	as
	begin
		forall i in 1..p_chunk_size
			insert into object_list (object_id)
			select o.object_id
			from objects o
			where o.load_with = p_loadwiths(i) and o.deleted = 0;

		return sql%rowcount;
	end;

	procedure locate_contents (p_container_id number)
	as
	begin
		insert into object_list (object_id, container_level)
		select object_id, 100
		from objects o
		where o.load_with = p_container_id and o.deleted = 0;
	end;

	procedure locate_structure (p_object_id number, p_x out number, p_z out number, p_scene_id out varchar2, p_found out number)
	as
	begin
		select x, z, scene_id, 1 into p_x, p_z, p_scene_id, p_found
		from objects
		where object_id = p_object_id and deleted = 0 and
		      type_id in (1112885583,  -- BuildingObject
				  1212763727,  -- HarvesterInstallationObject
				  1229869903,  -- InstallationObject
				  1296649807); -- ManufactureInstallationObject
	exception
	    when no_data_found then
		p_found := 0;
	end;

	function get_characters (p_station_id number) return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
		select
			character_object,
			object_template_id,
			scene_id,
			object_name,
			container,
			x,
			y,
			z
		from character_view
		where station_id = p_station_id;

		return result_cursor;
	end;

	function load_chunk_object_list (p_scene_id varchar, p_node_x float, p_node_z float) return number
	as
		num number;
	begin
		select count(*)
		into num
		from objects
		where node_x = p_node_x
			and node_z = p_node_z
			and scene_id = p_scene_id
			and deleted = 0;

		if (num > 0) then
			insert into object_list (object_id, container_level)
			select object_id, level
			from objects
			start with
				node_x = p_node_x
				and node_z = p_node_z
				and scene_id = p_scene_id
				and deleted = 0
				and contained_by = 0
				and player_controlled = 'N'
			connect by
				prior object_id = contained_by
				and deleted = 0
				and player_controlled='N'
				and prior load_contents='Y';

			return sql%rowcount;
		else
			return 0;
		end if;
	end;

	function load_manf_schematic_attributes return cursortype
	as
		result_cursor cursortype;
	begin
	open result_cursor for
		select  /*+ ORDERED USE_NL(T) */ t.object_id, t.attribute_type, t.value
		from
			object_list l,
			manf_schematic_attributes t
		where t.object_id = l.object_id;

		return result_cursor;
	end;

	function load_armor return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.layer,
				t.object_template,
				t.effectiveness,
				t.integrity,
				t.special_protections,
				t.encumberance_0,
				t.encumberance_1,
				t.encumberance_2,
				t.encumberance_3,
				t.encumberance_4,
				t.encumberance_5,
				t.encumberance_6,
				t.encumberance_7,
				t.encumberance_8
			from
				object_list l,
				armor t
			where t.object_id = l.object_id;

		return result_cursor;
	end;

	function load_scripts return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T)*/
				t.object_id, t.script, t.sequence_no
			from
				object_list l,
				scripts t
			where t.object_id = l.object_id;

		return result_cursor;
	end;

	function load_object_variables return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T)*/
				t.object_id, t.name_id, t.type, t.value
			from
				object_list l,
				object_variables t
			where l.object_id = t.object_id
			and nvl(t.detached,0) = 0;

		return result_cursor;
	end;

	function load_property_lists return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id, t.list_id, t.value
			from object_list l, property_lists t
			where t.object_id = l.object_id;

		return result_cursor;
	end;

	function load_experience return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id, t.experience_type, t.points
			from object_list l, experience_points t
			where t.object_id = l.object_id;

		return result_cursor;
	end;

	function load_battlefield_participants return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select t.region_object_id, t.character_object_id, t.faction_id  /*+ ORDERED USE_NL(T) */
			from object_list l, battlefield_participants t
			where t.region_object_id = l.object_id; -- order does not matter

		return result_cursor;
	end;

	function load_messages return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(MESSAGES) */
				target, message_id, method, data, call_time, guaranteed, delivery_type
			from  object_list, messages
			where target =object_list.object_id;

		return result_cursor;
	end;

	function load_location return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select  /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.list_id,
				t.sequence_number,
				t.name,
				t.scene,
				t.x,
				t.y,
				t.z,
				t.radius
			from
				object_list l,
				location_lists t
			where t.object_id = l.object_id;

		return result_cursor;
	end;

	function load_object
	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				x,
				y,
				z,
				quaternion_w,
				quaternion_x,
				quaternion_y,
				quaternion_z,
				node_x,
				node_y,
				node_z,
				object_template_id,
				type_id,
				scene_id,
				controller_type,
				deleted,
				object_name,
				volume,
				contained_by,
				slot_arrangement,
				player_controlled,
				cache_version,
				load_contents,
				cash_balance,
				bank_balance,
				complexity,
				name_string_table,
				name_string_text,
				static_item_name,
				nvl(static_item_version,0),
				nvl(conversion_id,0),
				load_with,
				objvar_0_name,
				objvar_0_type,
				objvar_0_value,
				objvar_1_name,
				objvar_1_type,
				objvar_1_value,
				objvar_2_name,
				objvar_2_type,
				objvar_2_value,
				objvar_3_name,
				objvar_3_type,
				objvar_3_value,
				objvar_4_name,
				objvar_4_type,
				objvar_4_value,
				objvar_5_name,
				objvar_5_type,
				objvar_5_value,
				objvar_6_name,
				objvar_6_type,
				objvar_6_value,
				objvar_7_name,
				objvar_7_type,
				objvar_7_value,
				objvar_8_name,
				objvar_8_type,
				objvar_8_value,
				objvar_9_name,
				objvar_9_type,
				objvar_9_value,
				objvar_10_name,
				objvar_10_type,
				objvar_10_value,
				objvar_11_name,
				objvar_11_type,
				objvar_11_value,
				objvar_12_name,
				objvar_12_type,
				objvar_12_value,
				objvar_13_name,
				objvar_13_type,
				objvar_13_value,
				objvar_14_name,
				objvar_14_type,
				objvar_14_value,
				objvar_15_name,
				objvar_15_type,
				objvar_15_value,
				objvar_16_name,
				objvar_16_type,
				objvar_16_value,
				objvar_17_name,
				objvar_17_type,
				objvar_17_value,
				objvar_18_name,
				objvar_18_type,
				objvar_18_value,
				objvar_19_name,
				objvar_19_type,
				objvar_19_value,
				script_list,
				l.container_level
			from
				object_list l,
				objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function verify_containment_chain(p_start_with_object_id in number) return number
	as
	-- result codes:
		--    1 = containment chain is recursive and is in starting(character) object chain
		--        (can be fixed by placing the object in the world if its a character)
		--    2 = containment chain is recursive but not in starting object chain (this must be fixed manually)
		--    3 = no recursion in containment chain

		m_retval pls_integer;
		m_temp   pls_integer;
	begin
/*	        m_retval :=  2;

		select count(*) into m_temp
		from objects
		start with object_id = p_start_with_object_id
		connect by prior object_id = contained_by
		and object_id != p_start_with_object_id;
*/
		m_retval :=  1;

		select count(*) into m_temp
		from objects
		start with object_id = p_start_with_object_id
		connect by object_id = prior contained_by;

		m_retval :=  3;

		return m_retval;
	exception
		when others then
			return m_retval;
	end;

	function fix_player_containment_chain(p_start_with_object_id in number) return number
	as
	-- result codes:
		--    0 = database error
		--    4 = success fix player containment issues

		PRAGMA AUTONOMOUS_TRANSACTION;

	begin
		update objects set contained_by = 0 where object_id = p_start_with_object_id;
		admin.fix_load_with(p_start_with_object_id, p_start_with_object_id);
		commit;

		return 4;

	exception
		when others then
			return 0;
	end;



procedure verify_character (p_station_id in number, p_character_id in number, p_gold_schema in varchar2, p_approved out varchar2, p_character_name out varchar2, p_scene_id out varchar2, p_container_id out number, p_x out number, p_y out number, p_z out number, p_containment_check out number)
	as

	-- p_containment_check is a flag indicating the containment stautus to be used for logging on the C sid
		-- 0 = there was a database error trying to fix containment
		-- 1 = there is a recursive containment error in the character object chain that wasn't fixed
		-- 2 = there is a recursive containment error in the containment chain not in the character chain
		-- 3 = the containment chain is ok
		-- 4 = there was a recursive containment error in the character object chain that was fixed

	m_containment_ok pls_integer;

	wsx number := null;
	wsy number := null;
	wsz number := null;

	begin


	-- check containment chain
	m_containment_ok := verify_containment_chain(p_character_id);

	-- if containment is bad for the character object try to fix it
	if (m_containment_ok = 1) then
		m_containment_ok := fix_player_containment_chain(p_character_id);
	end if;

	p_containment_check := m_containment_ok;

	if (m_containment_ok >= 3) then

		select object_name, scene_id, contained_by, x, y, z, ws_x, ws_y, ws_z
		into p_character_name, p_scene_id, p_container_id, p_x, p_y, p_z, wsx, wsy, wsz
		from players p, objects o, creature_objects c
		where p.station_id = p_station_id
		and p.character_object = p_character_id
		and o.object_id = p.character_object
		and c.object_id = o.object_id
		and o.deleted = 0;

		if (p_container_id = 0) then
			begin
				p_container_id := p_character_id;
				p_approved := 'Y';
			end;
		else
			begin
				select object_id, x,y,z,'Y'
				into p_container_id, p_x, p_y, p_z, p_approved
				from objects
				where contained_by=0
				start with object_id = p_character_id
				connect by prior contained_by=object_id and prior scene_id=scene_id and player_controlled = 'N';

			exception
				when no_data_found then
					-- might be in a gold building
					if (p_gold_schema is not null) then
						begin
							execute immediate
								'select object_id, x,y,z,''Y'' ' ||
								'from ' || p_gold_schema || 'objects ' ||
								'where contained_by=0 ' ||
								'start with object_id = :container_id ' ||
								'connect by prior contained_by=object_id'
							into p_container_id, p_x, p_y, p_z, p_approved
							using p_container_id;

						exception
							when no_data_found then
							select object_id, x,y,z,'Y'
							into p_container_id, p_x, p_y, p_z, p_approved
							from objects
							where object_id = p_character_id;
						end;
					else
						select object_id, x,y,z,'Y'
						into p_container_id, p_x, p_y, p_z, p_approved
						from objects
						where object_id = p_character_id;
					end if;
			end;
		end if;

	else

		select 'N' into p_approved from dual;

	end if;


                if ( wsx is not null ) then
                        begin
                                 p_x := wsx;
                                 p_y := wsy;
                                 p_z := wsz;
                        end;
		end if;


		update players
		set last_login_time = sysdate
		where station_id = p_station_id
		and character_object = p_character_id;

	exception
		when no_data_found then
			select 'N'
			into p_approved
			from dual;
		when too_many_rows then
			select 'N'
			into p_approved
			from dual;
		when others then
			select 'N'
			into p_approved
			from dual;
	end;




	function load_waypoint
	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.waypoint_id,
				t.appearance_name_crc,
				t.location_x,
				t.location_y,
				t.location_z,
				t.location_cell,
				t.location_scene,
				t.name,
				t.color,
				t.active
			from
				object_list l,
				waypoints t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_player_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) USE_NL(A)*/
				t.object_id,
				t.station_id,
				a.house_id,
 				t.num_lots,
 				a.is_outcast,
 				a.cheater_level,
 				a.max_lots_adjustment,
				t.personal_profile_id,
				t.character_profile_id,
				t.skill_title,
				t.born_date,
				t.played_time,
				t.force_regen_rate,
				t.force_power,
				t.max_force_power,
				t.active_quests,
				t.completed_quests,
				t.current_quest,
				t.quests,
				t.role_icon_choice,
				t.quests2,
				t.quests3,
				t.quests4,
				t.skill_template,
				t.working_skill,
				nvl(t.current_gcw_points,0),
				nvl(t.current_gcw_rating,-1),
				nvl(t.current_pvp_kills,0),
				nvl(t.lifetime_gcw_points,0),
				nvl(t.max_gcw_imperial_rating,-1),
				nvl(t.max_gcw_rebel_rating,-1),
				nvl(t.lifetime_pvp_kills,0),
				nvl(t.next_gcw_rating_calc_time,0),
				t.collections,
				nvl(t.show_backpack,'Y'),
				nvl(t.show_helmet,'Y'),
				t.collections2
			from
				object_list l,
				player_objects t,
				accounts a
			where t.station_id = a.station_id and
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_resource_types return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select
				resource_id,
				resource_name,
				resource_class,
				attributes,
				fractal_seeds,
				depleted_timestamp
			from
				resource_types;

		return result_cursor;
	end;

 	function load_bounty_hunter_targets return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select object_id, target_id
			from bounty_hunter_targets
			where target_id <> 0;
		return result_cursor;
	end;

-- GENERATED PLSQL FOLLOWS
-- generated by makeloader.pl

	function load_battlefield_marker_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.region_name
			from
				object_list l,
				battlefield_marker_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_building_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.maintenance_cost,
				t.time_last_checked,
				t.is_public,
				t.city_id
			from
				object_list l,
				building_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_cell_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.cell_number,
				t.is_public
			from
				object_list l,
				cell_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_city_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id
			from
				object_list l,
				city_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_creature_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.scale_factor,
				t.states,
				t.posture,
				t.shock_wounds,
				t.master_id,
				t.rank,
				t.base_walk_speed,
				t.base_run_speed,
				t.attribute_0,
				t.attribute_1,
				t.attribute_2,
				t.attribute_3,
				t.attribute_4,
				t.attribute_5,
				t.attribute_6,
				t.attribute_7,
				t.attribute_8,
				t.attribute_9,
				t.attribute_10,
				t.attribute_11,
				t.attribute_12,
				t.attribute_13,
				t.attribute_14,
				t.attribute_15,
				t.attribute_16,
				t.attribute_17,
				t.attribute_18,
				t.attribute_19,
				t.attribute_20,
				t.attribute_21,
				t.attribute_22,
				t.attribute_23,
				t.attribute_24,
				t.attribute_25,
				t.attribute_26,
				t.persisted_buffs,
				t.ws_x,
				t.ws_y,
				t.ws_z
			from
				object_list l,
				creature_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_factory_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id
			from
				object_list l,
				factory_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_guild_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id
			from
				object_list l,
				guild_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_harvester_inst_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.installed_efficiency,
				t.max_extraction_rate,
				t.current_extraction_rate,
				t.max_hopper_amount,
				t.hopper_resource,
				t.hopper_amount,
				t.resource_type
			from
				object_list l,
				harvester_installation_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_installation_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.installation_type,
				t.activated,
				t.tick_count,
				t.activate_start_time,
				t.power,
				t.power_rate
			from
				object_list l,
				installation_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_intangible_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.count
			from
				object_list l,
				intangible_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_manf_schematic_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.creator_id,
				t.creator_name,
				t.items_per_container,
				t.manufacture_time,
				t.draft_schematic
			from
				object_list l,
				manf_schematic_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_manufacture_inst_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id
			from
				object_list l,
				manufacture_inst_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_mission_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.difficulty,
				t.end_x,
				t.end_y,
				t.end_z,
				t.end_cell,
				t.end_scene,
				t.mission_creator,
				t.reward,
				t.root_script_name,
				t.start_x,
				t.start_y,
				t.start_z,
				t.start_cell,
				t.start_scene,
				t.description_table,
				t.description_text,
				t.title_table,
				t.title_text,
				t.mission_holder_id,
				t.status,
				t.mission_type,
				t.target_appearance,
				t.target_name
			from
				object_list l,
				mission_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_planet_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.planet_name
			from
				object_list l,
				planet_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_resource_container_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.resource_type,
				t.quantity,
				t.source
			from
				object_list l,
				resource_container_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_ship_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.slide_dampener,
				t.current_chassis_hit_points,
				t.maximum_chassis_hit_points,
				t.chassis_type,
				t.cmp_armor_hp_maximum,
				t.cmp_armor_hp_current,
				t.cmp_efficiency_general,
				t.cmp_efficiency_eng,
				t.cmp_eng_maintenance,
				t.cmp_mass,
				t.cmp_crc,
				t.cmp_hp_current,
				t.cmp_hp_maximum,
				t.cmp_flags,
				t.cmp_names,
				t.weapon_damage_maximum,
				t.weapon_damage_minimum,
				t.weapon_effectiveness_shields,
				t.weapon_effectiveness_armor,
				t.weapon_eng_per_shot,
				t.weapon_refire_rate,
				t.weapon_ammo_current,
				t.weapon_ammo_maximum,
				t.weapon_ammo_type,
				t.shield_hp_front_maximum,
				t.shield_hp_back_maximum,
				t.shield_recharge_rate,
				t.capacitor_eng_maximum,
				t.capacitor_eng_recharge_rate,
				t.engine_acc_rate,
				t.engine_deceleration_rate,
				t.engine_pitch_acc_rate,
				t.engine_yaw_acc_rate,
				t.engine_roll_acc_rate,
				t.engine_pitch_rate_maximum,
				t.engine_yaw_rate_maximum,
				t.engine_roll_rate_maximum,
				t.engine_speed_maximum,
				t.reactor_eng_generation_rate,
				t.booster_eng_maximum,
				t.booster_eng_recharge_rate,
				t.booster_eng_consumption_rate,
				t.booster_acc,
				t.booster_speed_maximum,
				t.droid_if_cmd_speed,
				t.installed_dcd,
				t.chassis_cmp_mass_maximum,
				t.cmp_creators,
				t.cargo_hold_contents_maximum,
				t.cargo_hold_contents_current,
				t.cargo_hold_contents
			from
				object_list l,
				ship_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_static_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id
			from
				object_list l,
				static_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_tangible_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.max_hit_points,
				t.owner_id,
				t.visible,
				t.appearance_data,
				t.interest_radius,
				t.pvp_type,
				t.pvp_faction,
				t.damage_taken,
				t.custom_appearance,
				t.count,
				t.condition,
				t.creator_id,
				t.source_draft_schematic
			from
				object_list l,
				tangible_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_token_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.reference,
				t.target_server_template_name,
				t.target_shared_template_name,
				t.waypoint
			from
				object_list l,
				token_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_universe_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id
			from
				object_list l,
				universe_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_vehicle_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.bogus
			from
				object_list l,
				vehicle_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;

	function load_weapon_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.min_damage,
				t.max_damage,
				t.damage_type,
				t.elemental_type,
				t.elemental_value,
				t.attack_speed,
				t.wound_chance,
				t.accuracy,
				t.attack_cost,
				t.damage_radius,
				t.min_range,
				t.max_range
			from
				object_list l,
				weapon_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;


	function load_player_quest_object	return cursortype
	as
		result_cursor cursortype;
	begin
		open result_cursor for
			select /*+ ORDERED USE_NL(T) */
				t.object_id,
				t.title,
				t.description,
				t.creator,
				t.total_tasks,
				t.difficulty,
				t.task_title1,
				t.task_description1,
				t.task_title2,
				t.task_description2,
				t.task_title3,
				t.task_description3,
				t.task_title4,
				t.task_description4,
				t.task_title5,
				t.task_description5,
				t.task_title6,
				t.task_description6,
				t.task_title7,
				t.task_description7,
				t.task_title8,
				t.task_description8,
				t.task_title9,
				t.task_description9,
				t.task_title10,
				t.task_description10,
				t.task_title11,
				t.task_description11,
				t.task_title12,
				t.task_description12
			from
				object_list l,
				player_quest_objects t
			where
				t.object_id=l.object_id;

		return result_cursor;
	end;
end;

/

  GRANT EXECUTE ON "SWG"."LOADER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body LOGIN
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."LOGIN" 
as

	procedure register_new_cluster(p_cluster_name in varchar2, p_address in varchar2, p_cluster_id out number)
	as
	begin
		select id
		into p_cluster_id
		from cluster_list
		where name = p_cluster_name;

	exception
		when no_data_found then
			insert into cluster_list (id,name,address,secret,locked, not_recommended,group_id,
				online_player_limit,online_free_trial_limit,free_trial_can_create_char, online_tutorial_limit)
			select nvl(max(id)+1,1), p_cluster_name,p_address,'N','N','N',1,
				2500,250,'Y',350
			from cluster_list;

			select id
			into p_cluster_id
			from cluster_list
			where name = p_cluster_name;
	end;

	function get_cluster_list (p_group in number) return refcursor
	as
		result_cursor refcursor;
		maxCharacterPerAccount number;
	begin
		select account_limit into maxCharacterPerAccount
		from default_char_limits;

		open result_cursor for
			select id, name, address, port, secret, locked, not_recommended, maxCharacterPerAccount,
			online_player_limit,online_free_trial_limit,free_trial_can_create_char,online_tutorial_limit
			from cluster_list
			where group_id = p_group;

		return result_cursor;
	end;

	function get_avatar_list (p_station_id number, p_cluster_group number) return refcursor
	as
		result refcursor;
	begin
		open result for
		select
			c.character_name,
			c.template_id,
			c.object_id,
			c.cluster_id,
			c.character_type
		from
			swg_characters c, cluster_list l
		where
			c.cluster_id = l.id and
			l.group_id = p_cluster_group and
			station_id = p_station_id and
			enabled = 'Y';

		return result;
	end;

	function get_open_character_slots(p_station_id number, p_cluster_id number) return refcursor
	as
		result_cursor refcursor;
		over_account_limit number;
		over_cluster_limit number;
	begin
		-- does the account have too many characters, or does the cluster have too many characters?

		select account_limit - account_counter.num, cluster_limit - cluster_list.num_characters
		into over_account_limit, over_cluster_limit
		from
			(select count(*) num from swg_characters
			where (station_id = p_station_id 
			OR station_id IN (SELECT CASE WHEN child_id = p_station_id THEN parent_id 
			ELSE child_id END as station_id FROM account_map WHERE parent_id = p_station_id 
			OR child_id = p_station_id)) and enabled ='Y') account_counter,
			default_char_limits,
			cluster_list
		where
			cluster_list.id = p_cluster_id;

		if (over_account_limit <= 0 or over_cluster_limit <= 0) then
			open result_cursor for
			select 0 character_type_id, 0 remaining_slots
			from dual
			where 1=2;

			return result_cursor;
		end if;

		-- if not, return the number of each type of character we're allowed to create

		open result_cursor for
		select limits.character_type_id, limits.limit - nvl(existing.num,0) remaining_slots
		from
			(select def.character_type_id, def.num_slots + nvl(cls.num_extra_slots,0) limit
			from extra_character_slots cls, default_character_slots def
			where def.character_type_id = cls.character_type_id (+)
			and cls.station_id (+) = p_station_id
			and cls.cluster_id (+) = p_cluster_id) limits,

			(select character_type, count(*) num
			from swg_characters
			where station_id = p_station_id
			and cluster_id = p_cluster_id
			and enabled = 'Y'
			group by character_type) existing
		where
			limits.character_type_id = existing.character_type (+);

		return result_cursor;
	end;

	-- unlike get_open_character_slots, this function ignores account and cluster limits
	function get_only_open_character_slots(p_station_id number, p_cluster_id number) return refcursor
	as
		result_cursor refcursor;
	begin
		-- return the number of each type of character we're allowed to create

		open result_cursor for
		select limits.character_type_id, limits.limit - nvl(existing.num,0) remaining_slots
		from
			(select def.character_type_id, def.num_slots + nvl(cls.num_extra_slots,0) limit
			from extra_character_slots cls, default_character_slots def
			where def.character_type_id = cls.character_type_id (+)
			and cls.station_id (+) = p_station_id
			and cls.cluster_id (+) = p_cluster_id) limits,

			(select character_type, count(*) num
			from swg_characters
			where station_id = p_station_id
			and cluster_id = p_cluster_id
			and enabled = 'Y'
			group by character_type) existing
		where
			limits.character_type_id = existing.character_type (+);

		return result_cursor;
	end;

	function is_cluster_at_limit(p_cluster_id number) return number
	as
		v_cluster_limit number;
		v_num_characters number;
	begin
		select cluster_limit
		into v_cluster_limit
		from default_char_limits;

		select num_characters
		into v_num_characters
		from cluster_list
		where id = p_cluster_id;

		if (v_num_characters >= v_cluster_limit) then
			return 1;
		else
			return 0;
		end if;

	exception
		when others then
			return 0;
	end;

	function is_account_at_limit(p_station_id number) return number
	as
		v_account_limit number;
		v_num_characters number;
	begin
		select account_limit
		into v_account_limit
		from default_char_limits;

		select count(*)
		into v_num_characters
		from swg_characters
		where station_id = p_station_id and enabled ='Y' and cluster_id not in (select id from cluster_list where name in ('Corbantis', 'Europe-Infinity', 'Intrepid', 'Kauri', 'Kettemoor', 'Lowca', 'Naritus', 'Scylla', 'Tarquinas', 'Tempest', 'Valcyn', 'Wanderhome', 'Japan-Katana', 'Japan-Harla'));

		if (v_num_characters >= v_account_limit) then
			return 1;
		else
			return 0;
		end if;

	exception
		when others then
			return 0;
	end;

	procedure delete_character(p_cluster_id number, p_character_id number, p_station_id number)
	as
	begin
		delete from swg_characters
		where station_id = p_station_id
		and cluster_id = p_cluster_id
		and object_id = p_character_id;

		update cluster_list
		set num_characters = num_characters - 1
		where cluster_list.id = p_cluster_id;

	end;

	procedure rename_character(p_cluster_id number, p_character_id number, p_new_name varchar2)
	as
	begin
		update swg_characters
		set character_name = p_new_name
		where cluster_id = p_cluster_id
		and object_id = p_character_id;
	end;

	procedure create_character(p_cluster_id number, p_station_id number, p_character_name varchar2, p_character_id number, p_template_id number, p_character_type number)
	as
	begin
		insert into swg_characters (station_id, cluster_id, character_name, object_id, template_id, character_type)
		values (p_station_id, p_cluster_id, p_character_name, p_character_id, p_template_id, p_character_type);

		update cluster_list
		set num_characters = nvl(num_characters,0) + 1
		where cluster_list.id = p_cluster_id;

		exception when DUP_VAL_ON_INDEX then
			update swg_characters
			set object_id = p_character_id,
			template_id = p_template_id,
			character_type = p_character_type
			where cluster_id = p_cluster_id
			and station_id = p_station_id
			and character_name = p_character_name;
	end;

	function restore_character(p_cluster_id number, p_station_id number, p_character_name varchar2, p_character_id number, p_template_id number, p_character_type number) return number
	-- Return codes:
	-- 1: restored
	-- 2: restored, but too many characters on the account now
	-- 3: database error
	as
		l_num_characters number;
		l_limit number;
	begin
		begin
			insert into swg_characters (station_id, cluster_id, character_name, object_id, template_id, character_type)
			values (p_station_id, p_cluster_id, p_character_name, p_character_id, p_template_id, p_character_type);

			update cluster_list
			set num_characters = nvl(num_characters,0) + 1
			where cluster_list.id = p_cluster_id;

			exception when DUP_VAL_ON_INDEX then
				null; -- already restored
			when others then
				return 3;
		end;

		-- Check the account against the limits
		select count(*)
		into l_num_characters
		from swg_characters
		where station_id = p_station_id
		and character_type = p_character_type
		and enabled = 'Y'
		and cluster_id not in (select id from cluster_list where name in ('Corbantis', 'Europe-Infinity', 'Intrepid', 'Kauri', 'Kettemoor', 'Lowca', 'Naritus', 'Scylla', 'Tarquinas', 'Tempest', 'Valcyn', 'Wanderhome', 'Japan-Katana', 'Japan-Harla'));

		select def.num_slots + nvl(cls.num_extra_slots,0)
		into l_limit
		from extra_character_slots cls, default_character_slots def
		where def.character_type_id = cls.character_type_id (+)
		and cls.station_id (+) = p_station_id
		and cls.cluster_id (+) = p_cluster_id
		and def.character_type_id = p_character_type;

		if (l_num_characters > l_limit) then
			return 2;
		else
			return 1;
		end if;

	exception
		when others then
			return 3;
	end;

	procedure set_character_slots(p_cluster_id number, p_station_id number, p_slot_type number, p_num_slots number)
	as
	begin
		update extra_character_slots
		set num_extra_slots = p_num_slots
		where cluster_id = p_cluster_id
		and station_id = p_station_id
		and character_type_id = p_slot_type;

		if (sql%rowcount = 0) then
			insert into extra_character_slots (station_id, cluster_id, character_type_id, num_extra_slots)
			values (p_station_id, p_cluster_id, p_slot_type, p_num_slots);
		end if;
	end;

	procedure set_character_type(p_cluster_id number, p_station_id number, p_character_id number, p_slot_type number)
	as
	begin
		update swg_characters
		set character_type = p_slot_type
		where station_id = p_station_id
		and cluster_id = p_cluster_id
		and object_id = p_character_id;
	end;

	function has_extra_character_slot(p_station_id number, p_character_type number) return number
	as
		rows number;
		total number;
	begin
		select count(*), sum(num_extra_slots)
		into rows, total
		from extra_character_slots
		where station_id = p_station_id
		and character_type_id = p_character_type;

		if (rows <= 0 or total < 0) then
			total := 0;
		end if;

		return total;
	exception
		when others then
			return 0;
	end;

	procedure toggle_disable_character(p_cluster_id number, p_character_id number, p_station_id number, p_enabled varchar2)
	as
	begin
		update swg_characters
		set enabled = p_enabled
		where station_id = p_station_id
		and cluster_id = p_cluster_id
		and object_id = p_character_id;

	end;

	function enable_disable_character(p_station_id number, p_character_id number, p_enabled varchar2) return number
	as
	begin
		update swg_characters
		set enabled = p_enabled
		where station_id = p_station_id and
		      object_id = p_character_id;
		if (sql%rowcount > 0) then
			return 1;
		else
			return 2;
		end if;
	exception
		when others then
			return 3;
	end;

	function get_completed_tutorial(p_station_id number) return refcursor
	as
		cnt number;
		result_cursor refcursor;
	begin
		select count (*) into cnt
		from account_info
		where station_id = p_station_id;

		if (cnt = 0) then
			insert into account_info (station_id, completed_tutorial)
			values (p_station_id, 'N');
		end if;

		open result_cursor for
		select completed_tutorial
		from account_info
		where station_id = p_station_id;

		return result_cursor;
	end;

	procedure toggle_completed_tutorial(p_station_id number, p_completed varchar2)
	as
	begin
		update account_info
		set completed_tutorial = p_completed
		where station_id = p_station_id;
	end;

	function get_consumed_reward_events(p_station_id number) return refcursor
	as
		result_cursor refcursor;
	begin
		open result_cursor for
		select event_id, cluster_id, character_id
		from account_reward_events
		where station_id = p_station_id;

		return result_cursor;
	end;

	function get_claimed_reward_items(p_station_id number) return refcursor
	as
		result_cursor refcursor;
	begin
		open result_cursor for
		select item_id, cluster_id, character_id
		from account_reward_items
		where station_id = p_station_id;

		return result_cursor;
	end;

	function consume_reward_event(p_station_id number, p_character_id number, p_cluster_id number, p_event_id varchar2) return number
	as
	begin
		insert into account_reward_events (station_id, event_id, date_consumed, cluster_id, character_id)
		values (p_station_id, p_event_id, sysdate, p_cluster_id, p_character_id);

		return 1;

	exception
		when dup_val_on_index then
			-- Check whether previous claim was from the same character and cluster, if so, allow it
			declare
				previous_claim_cluster number;
				previous_claim_character number;
			begin
				select cluster_id, character_id
				into previous_claim_cluster, previous_claim_character
				from account_reward_events
				where station_id = p_station_id
				and event_id = p_event_id;

				if ((p_cluster_id=previous_claim_cluster) and (p_character_id=previous_claim_character)) then
					return 1;
				end if;

				return 0;
			end;
		when others then
			return 0;
	end;

	function claim_reward_item(p_station_id number, p_character_id number, p_cluster_id number, p_item_id varchar2) return number
	as
	begin
		insert into account_reward_items (station_id, item_id, date_claimed, cluster_id, character_id)
		values (p_station_id, p_item_id, sysdate, p_cluster_id, p_character_id);

		return 1;

	exception
		when dup_val_on_index then
			-- Check whether previous claim was from the same character and cluster, if so, allow it
			declare
				previous_claim_cluster number;
				previous_claim_character number;
			begin
				select cluster_id, character_id
				into previous_claim_cluster, previous_claim_character
				from account_reward_items
				where station_id = p_station_id
				and item_id = p_item_id;

				if ((p_cluster_id=previous_claim_cluster) and (p_character_id=previous_claim_character)) then
					return 1;
				end if;

				return 0;
			exception
				when others then
					return 0;
			end;
		when others then
			return 0;
	end;

	function get_feature_id_transactions(p_station_id in number, p_cluster_id in number, p_character_id in number) return refcursor
	as
		result_cursor refcursor;
	begin
		open result_cursor for
		select item_id, count
		from feature_id_transactions
		where station_id = p_station_id and cluster_id = p_cluster_id and character_id = p_character_id;

		return result_cursor;
	end;

	function update_feature_id_transaction(p_station_id in number, p_cluster_id in number, p_character_id in number, p_item_id in varchar2, p_count_adjustment in number) return number
	as
	begin
		update feature_id_transactions set date_updated = sysdate,
		count = count + p_count_adjustment
		where station_id = p_station_id
		and cluster_id = p_cluster_id
		and character_id = p_character_id
		and item_id = p_item_id;

		if (sql%rowcount = 0) then
			insert into feature_id_transactions (station_id, cluster_id, character_id, item_id, date_updated, count)
			values (p_station_id, p_cluster_id, p_character_id, p_item_id, sysdate, p_count_adjustment);
		end if;

		return 1;

	exception
		when others then
			return 0;
	end;
end;

/

  GRANT EXECUTE ON "SWG"."LOGIN" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body OBJECTIDMANAGER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."OBJECTIDMANAGER" 
as

	procedure get_ids(how_many in out number, block_start_id out number, block_end_id out number)
	as
		result_cursor cursortype;
	begin
		delete free_object_ids
		where end_id is not null
		and rownum=1
		returning start_id, end_id
		into block_start_id, block_end_id;

		if (sql%rowcount = 0) then
			update free_object_ids
			set start_id = start_id + how_many
			where end_id is null
			returning start_id - how_many, start_id - 1
			into block_start_id, block_end_id;
		end if;

		how_many := block_end_id - block_start_id + 1;
	end;

	-- same as get_ids, except guarantees the ids are all contiguous
	-- (therefore it can return just the starting id)
	function get_contiguous_ids(min_count number) return number
	as
		result_cursor cursortype;
		block_start_id number;
		block_end_id number;
	begin
		update free_object_ids
		set start_id = start_id + min_count
		where (end_id - start_id + 1 >= min_count
		or end_id is null)
		and rownum < 2
		returning start_id - min_count, start_id - 1
		into block_start_id, block_end_id;

		if (block_start_id > block_end_id) then -- entire block was consumed
			delete free_object_ids where start_id = block_start_id;
		end if;

		return block_start_id;
	end;

	-- get only one id
	function get_single_id return number
	as
		block_start_id number;
		block_end_id number;
	begin
		update
			free_object_ids
		set
			start_id = start_id + 1
		where
			rownum=1
		returning
			start_id,
			end_id
		into
			block_start_id,
			block_end_id;

		if (block_start_id > block_end_id) then -- entire block was consumed
			delete free_object_ids where start_id = block_start_id;
		end if;

		return block_start_id - 1;
	end;

	procedure rebuild_freelist
	as
		message_count number;
		message_id_block number;
	begin
		delete free_object_ids;

		-- following is not legal in PL/SQL, so it must be "execute immediated"
		execute immediate 'insert into free_object_ids (end_id, start_id) '||
		'select o1.object_id-1 end_id, (select max(o2.object_id) from objects o2 where o1.object_id > o2.object_id)+1 start_id ' ||
		'from objects o1 ' ||
		'where o1.object_id > (select max(o2.object_id)+1 from objects o2 where o1.object_id > o2.object_id)';

		insert into free_object_ids (start_id, end_id)
		select * from
			(select 1,min(object_id)-1
			from objects)
		where not exists (select * from objects where object_id = 1);

		insert into free_object_ids (start_id, end_id)
		select * from
			(select max(object_id)+1,NULL
			from objects)
		where exists (select * from objects);

		--easier to ignore messages while finding free object ids and then fix them up at the end:

		select count(*)
		into message_count
		from messages
		where rownum = 1;

		if (message_count <> 0) then
			message_id_block := get_contiguous_ids(message_count);

			update messages
			set message_id = rownum + message_id_block - 1;
		end if;
	end;
end;

/

  GRANT EXECUTE ON "SWG"."OBJECTIDMANAGER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body OBJVAR_NAMES
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."OBJVAR_NAMES" 
as
	procedure add_name (p_id number, p_name varchar2) as
	begin
		insert into object_variable_names (id,name)
		values (p_id, p_name);
	end;

	function get_name_list return cursortype as
		result_cursor cursortype;
	begin
		open result_cursor for
			select id, name from object_variable_names;

		return result_cursor;
	end;
end;

/

  GRANT EXECUTE ON "SWG"."OBJVAR_NAMES" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body PERSISTER
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."PERSISTER" 
as

	procedure set_clock (p_time number)
	as
	begin
		update clock set last_save_time = p_time, last_save_timestamp = sysdate;
	end;

	procedure add_player (p_station_id number, p_character_object objectid, p_character_name varchar2, p_normalized_name varchar2)
	as
		rc number;
	begin
		insert into players (station_id, character_object,uc_character_name, character_full_name, create_time)
		values (p_station_id, p_character_object, p_normalized_name, p_character_name, sysdate);
	end;

	function delete_character (p_station_id number, p_character_id number, p_delete_minutes number) return number
	as
		valid_check number;
		l_deleted_name number;
	begin
		l_deleted_name := 0;

		select count(*)
		into valid_check
		from players
		where players.character_object = p_character_id
			and players.station_id = p_station_id;

		if (valid_check = 1) then

			-- recursive query needed in order to get bank box contents, etc.
			update objects
			set
				deleted = (select reason_code from delete_reasons where tag='CharacterDeleted'),
				deleted_date = sysdate
			where object_id in (select object_id
				from objects
				where deleted = 0
				start with load_with = p_character_id
				connect by prior object_id = load_with and prior load_with <> load_with);

			-- remove character record if the character is new enough (so that players can experiment creating new characters
			-- and deleting them right away)
			delete players
			where players.character_object = p_character_id
			and players.station_id = p_station_id
			and (sysdate - create_time) * (1440) < p_delete_minutes;

			if (sql%rowcount > 0) then
				l_deleted_name := 1;
			end if;

			-- Add a message for all deleted buildings owned by this character.  The game will delete the buildings
			-- and run appropriate cleanup the next time the buildings are loaded.

			for oid in (select o.object_id from objects o, tangible_objects t, building_objects b
				where o.object_id = t.object_id
				and o.object_id = b.object_id
				and t.object_id = b.object_id
				and t.owner_id = p_character_id
				and o.deleted = 0)
			loop
				save_message (objectidmanager.get_single_id(), oid.object_id, 'msgDestroyStructure',NULL,0,'Y',1);
			end loop;

			for oid1 in (select o.object_id from objects o, tangible_objects t, installation_objects b
				where o.object_id = t.object_id
				and o.object_id = b.object_id
				and t.owner_id = p_character_id
				and o.deleted = 0)
			loop
				save_message (objectidmanager.get_single_id(), oid1.object_id, 'msgDestroyStructure',NULL,0,'Y',1);
			end loop;

			if (l_deleted_name=0) then
				return 0;
			else
				return 2;
			end if;
		else
			return 1;
		end if;
	end;


	procedure update_object_variable_batch (p_object_id vaofstring, p_name_id VAOFNUMBER, p_type VAOFNUMBER, p_value VAOFSTRING, p_chunk_size number)
	as
	begin
		FORALL i in 1..p_chunk_size
			UPDATE OBJECT_VARIABLES Set
				type = p_type(i),
				value = p_value(i),
				detached = 0
			WHERE
				object_id = p_object_id(i) and
				name_id = p_name_id(i);
	end;

	procedure add_object_variable_batch (p_object_id vaofstring, p_name_id VAOFNUMBER, p_type VAOFNUMBER, p_value VAOFSTRING, p_chunk_size number)
	as
		errors number;
		error_index number;
	begin
		FORALL i in 1..p_chunk_size
			INSERT into OBJECT_VARIABLES (
				object_id,
				name_id,
				type,
				value,
				detached )
			VALUES (
				p_object_id(i),
				p_name_id(i),
				p_type(i),
				p_value(i),
				0 );

		exception
			when DUP_VAL_ON_INDEX then
				for i in 1..p_chunk_size loop
					UPDATE OBJECT_VARIABLES Set
						type = p_type(i),
						value = p_value(i),
						detached = 0
					WHERE
						object_id = p_object_id(i) and
						name_id = p_name_id(i);

					if SQL%ROWCOUNT=0 then
						INSERT into OBJECT_VARIABLES (
							object_id,
							name_id,
							type,
							value,
							detached )
						VALUES (
							p_object_id(i),
							p_name_id(i),
							p_type(i),
							p_value(i),
							0 );
					end if;
				end loop;
	end;

	procedure remove_object_variable_batch (p_object_id vaofstring, p_name_id VAOFNUMBER, p_chunk_size number)
	as
	begin
		FORALL i in 1..p_chunk_size
			delete from object_variables
			where object_id = p_object_id(i)
			and name_id = p_name_id(i);
	end;

	procedure clear_scripts (p_object_id objectid)
	as
	begin
		delete from scripts
		where object_id = p_object_id;
	end;

	procedure save_message (p_message_id number, p_object_id objectid, p_method varchar, p_data varchar, p_call_time number, p_guaranteed varchar, p_delivery_type int)
	as
	begin
		insert into messages (message_id, target, method, data, call_time, guaranteed, delivery_type)
		values (p_message_id, p_object_id, p_method, p_data, p_call_time, p_guaranteed, p_delivery_type);
	end;

	procedure save_message_batch (p_message_id VAOFSTRING, p_object_id VAOFSTRING, p_method VAOFSTRING, p_data VAOFLONGSTRING, p_call_time VAOFNUMBER, p_guaranteed VAOFSTRING, p_delivery_type VAOFNUMBER, p_chunk_size number, p_enable_db_logging number )
	as
	begin

		forall i in 1..p_chunk_size
			insert into messages (message_id, target, method, data, call_time, guaranteed, delivery_type)
			values (p_message_id(i), p_object_id(i), p_method(i), p_data(i), p_call_time(i), p_guaranteed(i), p_delivery_type(i));

		exception when dup_val_on_index then
				for i in 1..p_chunk_size loop
					begin
						insert into messages (message_id, target, method, data, call_time, guaranteed, delivery_type)
						values (p_message_id(i), p_object_id(i), p_method(i), p_data(i), p_call_time(i), p_guaranteed(i), p_delivery_type(i));
					exception when dup_val_on_index then
						if ( p_enable_db_logging > 0 ) then

							db_error_logger.dblogerror( SQLCODE, 'procedure save_message_batch: duplicate rows were sent to the message buffer that resulted in a dup_val_on_index error.');
							if ( p_enable_db_logging > 1 ) then

								db_error_logger.dblogerror_values( 'messages', 'message_id' , 'number', p_message_id(i));
								db_error_logger.dblogerror_values( 'messages', 'target' , 'number', p_object_id(i));
								db_error_logger.dblogerror_values( 'messages', 'method' , 'varchar2', p_method(i));
								db_error_logger.dblogerror_values( 'messages', 'data' , 'varchar2', p_data(i));
								db_error_logger.dblogerror_values( 'messages', 'call_time' , 'number', to_char(p_call_time(i)));
								db_error_logger.dblogerror_values( 'messages', 'guaranteed' , 'varchar2', p_guaranteed(i));
								db_error_logger.dblogerror_values( 'messages', 'delivery_type' , 'number', to_char(p_delivery_type(i)));

							end if;

						else
							NULL;
						end if;
					end;
				end loop;
	end;


	procedure acknowledge_message(p_message_id number)
	as
	begin
		delete from messages
		where message_id = p_message_id;
	end;

	procedure acknowledge_message_batch (p_message_id VAOFSTRING, p_chunk_size number, p_enable_db_logging number)
	as
	begin

		forall i in 1..p_chunk_size
			delete from messages
			where message_id = p_message_id(i);

		exception when dup_val_on_index then
				for i in 1..p_chunk_size loop
					begin
						delete from messages
						where message_id = p_message_id(i);
					exception when dup_val_on_index then
						if ( p_enable_db_logging > 0 ) then

							db_error_logger.dblogerror( SQLCODE, 'procedure acknowledge_message_batch: duplicate rows were sent to the message buffer that resulted in a dup_val_on_index error.');
							if ( p_enable_db_logging > 1 ) then

								db_error_logger.dblogerror_values( 'messages', 'message_id' , 'number', p_message_id(i));

							end if;

						else
							NULL;
						end if;
					end;
				end loop;


	end;

	procedure save_object ( p_x VAOFNUMBER, p_y VAOFNUMBER, p_z VAOFNUMBER, p_quaternion_w VAOFNUMBER, p_quaternion_x VAOFNUMBER, p_quaternion_y VAOFNUMBER, p_quaternion_z VAOFNUMBER, p_node_x VAOFNUMBER, p_node_y VAOFNUMBER, p_node_z VAOFNUMBER, p_object_template_id VAOFNUMBER, p_type_id VAOFNUMBER, p_scene_id VAOFSTRING, p_controller_type VAOFNUMBER, p_deleted VAOFNUMBER, p_object_name VAOFSTRING, p_volume VAOFNUMBER, p_contained_by VAOFSTRING, p_slot_arrangement VAOFNUMBER, p_player_controlled VAOFSTRING, p_cache_version VAOFNUMBER, p_load_contents VAOFSTRING, p_cash_balance VAOFNUMBER, p_bank_balance VAOFNUMBER, p_complexity VAOFNUMBER, p_name_string_table VAOFSTRING, p_name_string_text VAOFSTRING, p_static_item_name VAOFSTRING, p_static_item_version VAOFNUMBER, p_conversion_id VAOFNUMBER, p_load_with VAOFSTRING,
		p_objvar_0_name VAOFSTRING,p_objvar_0_type VAOFNUMBER,p_objvar_0_value VAOFSTRING,p_objvar_1_name VAOFSTRING,p_objvar_1_type VAOFNUMBER,p_objvar_1_value VAOFSTRING,p_objvar_2_name VAOFSTRING,p_objvar_2_type VAOFNUMBER,p_objvar_2_value VAOFSTRING,p_objvar_3_name VAOFSTRING,p_objvar_3_type VAOFNUMBER,p_objvar_3_value VAOFSTRING,p_objvar_4_name VAOFSTRING,p_objvar_4_type VAOFNUMBER,p_objvar_4_value VAOFSTRING,p_objvar_5_name VAOFSTRING,p_objvar_5_type VAOFNUMBER,p_objvar_5_value VAOFSTRING,p_objvar_6_name VAOFSTRING,p_objvar_6_type VAOFNUMBER,p_objvar_6_value VAOFSTRING,p_objvar_7_name VAOFSTRING,p_objvar_7_type VAOFNUMBER,p_objvar_7_value VAOFSTRING,p_objvar_8_name VAOFSTRING,p_objvar_8_type VAOFNUMBER,p_objvar_8_value VAOFSTRING,p_objvar_9_name VAOFSTRING,p_objvar_9_type VAOFNUMBER,p_objvar_9_value VAOFSTRING, p_objvar_10_name VAOFSTRING,p_objvar_10_type VAOFNUMBER,p_objvar_10_value VAOFSTRING,p_objvar_11_name VAOFSTRING,p_objvar_11_type VAOFNUMBER,p_objvar_11_value VAOFSTRING,p_objvar_12_name VAOFSTRING,p_objvar_12_type VAOFNUMBER,p_objvar_12_value VAOFSTRING,p_objvar_13_name VAOFSTRING,p_objvar_13_type VAOFNUMBER,p_objvar_13_value VAOFSTRING,p_objvar_14_name VAOFSTRING,p_objvar_14_type VAOFNUMBER,p_objvar_14_value VAOFSTRING,p_objvar_15_name VAOFSTRING,p_objvar_15_type VAOFNUMBER,p_objvar_15_value VAOFSTRING,p_objvar_16_name VAOFSTRING,p_objvar_16_type VAOFNUMBER,p_objvar_16_value VAOFSTRING,p_objvar_17_name VAOFSTRING,p_objvar_17_type VAOFNUMBER,p_objvar_17_value VAOFSTRING,p_objvar_18_name VAOFSTRING,p_objvar_18_type VAOFNUMBER,p_objvar_18_value VAOFSTRING,p_objvar_19_name VAOFSTRING,p_objvar_19_type VAOFNUMBER,p_objvar_19_value VAOFSTRING, p_script_list VAOFLONGSTRING, p_object_id VAOFSTRING, p_chunk_size number)
	as
		cache_update VAOFNUMBER;
	begin

	  cache_update := VAOFNUMBER();   -- initialize VARRAY object
	  cache_update.extend(p_chunk_size); -- allocate VARRAY object memory to chunk size

	  -- create cache_update array for use in bulk update
	  FOR i IN 1..p_chunk_size
	  LOOP
		if
			((p_x(i) is not null)
			or (p_y(i) is not null)
			or (p_z(i) is not null)
			or (p_quaternion_w(i) is not null)
			or (p_quaternion_x(i) is not null)
			or (p_quaternion_y(i) is not null)
			or (p_quaternion_z(i) is not null)
			or (p_contained_by(i) is not null)
			or (p_cache_version(i) is not null))
		then
			cache_update(i) := 0;
		else
			cache_update(i) := NULL;
		end if;
	  END LOOP;


	  -- process deletes
	  FORALL i IN 1..p_chunk_size
	  update objects set
	  deleted = p_deleted(i),
	  deleted_date = sysdate,
	  load_with = NULL
	  where object_id = p_object_id(i) and
	  p_deleted(i) <> 0;

	  -- process updates
	  FORALL i IN 1..p_chunk_size
	  update objects set
	  x = nvl(p_x(i),x),
	  y = nvl(p_y(i),y),
	  z = nvl(p_z(i),z),
	  quaternion_w = nvl(p_quaternion_w(i),quaternion_w),
	  quaternion_x = nvl(p_quaternion_x(i),quaternion_x),
	  quaternion_y = nvl(p_quaternion_y(i),quaternion_y),
	  quaternion_z = nvl(p_quaternion_z(i),quaternion_z),
	  node_x = nvl(p_node_x(i),node_x),
	  node_y = nvl(p_node_y(i),node_y),
	  node_z = nvl(p_node_z(i),node_z),
	  object_template_id = nvl(p_object_template_id(i),object_template_id),
	  type_id = nvl(p_type_id(i),type_id),
	  scene_id = nvl(p_scene_id(i),scene_id),
	  controller_type = nvl(p_controller_type(i),controller_type),
	  deleted = nvl(p_deleted(i),deleted),
	  object_name = nvl(p_object_name(i),object_name),
	  volume = nvl(p_volume(i),volume),
	  contained_by = nvl(p_contained_by(i),contained_by),
	  slot_arrangement = nvl(p_slot_arrangement(i),slot_arrangement),
	  player_controlled = nvl(p_player_controlled(i),player_controlled),
	  cache_version = nvl(cache_update(i),cache_version),
	  load_contents = nvl(p_load_contents(i),load_contents),
	  cash_balance = nvl(p_cash_balance(i),cash_balance),
	  bank_balance = nvl(p_bank_balance(i),bank_balance),
	  complexity = nvl(p_complexity(i),complexity),
	  name_string_table = nvl(p_name_string_table(i),name_string_table),
	  name_string_text = nvl(p_name_string_text(i),name_string_text),
      static_item_name = nvl(p_static_item_name(i),static_item_name),
      static_item_version = nvl(p_static_item_version(i),static_item_version),
      conversion_id = nvl(p_conversion_id(i),conversion_id),
	  load_with = nvl(p_load_with(i),load_with),

	  objvar_0_name = nvl(p_objvar_0_name(i), objvar_0_name),
	  objvar_0_type = nvl(p_objvar_0_type(i), objvar_0_type),
	  objvar_0_value= nvl(p_objvar_0_value(i),objvar_0_value),
	  objvar_1_name = nvl(p_objvar_1_name(i), objvar_1_name),
	  objvar_1_type = nvl(p_objvar_1_type(i), objvar_1_type),
	  objvar_1_value= nvl(p_objvar_1_value(i),objvar_1_value),
	  objvar_2_name = nvl(p_objvar_2_name(i), objvar_2_name),
	  objvar_2_type = nvl(p_objvar_2_type(i), objvar_2_type),
	  objvar_2_value= nvl(p_objvar_2_value(i),objvar_2_value),
	  objvar_3_name = nvl(p_objvar_3_name(i), objvar_3_name),
	  objvar_3_type = nvl(p_objvar_3_type(i), objvar_3_type),
	  objvar_3_value= nvl(p_objvar_3_value(i),objvar_3_value),
	  objvar_4_name = nvl(p_objvar_4_name(i), objvar_4_name),
	  objvar_4_type = nvl(p_objvar_4_type(i), objvar_4_type),
	  objvar_4_value= nvl(p_objvar_4_value(i),objvar_4_value),
	  objvar_5_name = nvl(p_objvar_5_name(i), objvar_5_name),
	  objvar_5_type = nvl(p_objvar_5_type(i), objvar_5_type),
	  objvar_5_value= nvl(p_objvar_5_value(i),objvar_5_value),
	  objvar_6_name = nvl(p_objvar_6_name(i), objvar_6_name),
	  objvar_6_type = nvl(p_objvar_6_type(i), objvar_6_type),
	  objvar_6_value= nvl(p_objvar_6_value(i),objvar_6_value),
	  objvar_7_name = nvl(p_objvar_7_name(i), objvar_7_name),
	  objvar_7_type = nvl(p_objvar_7_type(i), objvar_7_type),
	  objvar_7_value= nvl(p_objvar_7_value(i),objvar_7_value),
	  objvar_8_name = nvl(p_objvar_8_name(i), objvar_8_name),
	  objvar_8_type = nvl(p_objvar_8_type(i), objvar_8_type),
	  objvar_8_value= nvl(p_objvar_8_value(i),objvar_8_value),
	  objvar_9_name = nvl(p_objvar_9_name(i), objvar_9_name),
	  objvar_9_type = nvl(p_objvar_9_type(i), objvar_9_type),
	  objvar_9_value= nvl(p_objvar_9_value(i),objvar_9_value),

	  objvar_10_name = nvl(p_objvar_10_name(i), objvar_10_name),
	  objvar_10_type = nvl(p_objvar_10_type(i), objvar_10_type),
	  objvar_10_value= nvl(p_objvar_10_value(i),objvar_10_value),
	  objvar_11_name = nvl(p_objvar_11_name(i), objvar_11_name),
	  objvar_11_type = nvl(p_objvar_11_type(i), objvar_11_type),
	  objvar_11_value= nvl(p_objvar_11_value(i),objvar_11_value),
	  objvar_12_name = nvl(p_objvar_12_name(i), objvar_12_name),
	  objvar_12_type = nvl(p_objvar_12_type(i), objvar_12_type),
	  objvar_12_value= nvl(p_objvar_12_value(i),objvar_12_value),
	  objvar_13_name = nvl(p_objvar_13_name(i), objvar_13_name),
	  objvar_13_type = nvl(p_objvar_13_type(i), objvar_13_type),
	  objvar_13_value= nvl(p_objvar_13_value(i),objvar_13_value),
	  objvar_14_name = nvl(p_objvar_14_name(i), objvar_14_name),
	  objvar_14_type = nvl(p_objvar_14_type(i), objvar_14_type),
	  objvar_14_value= nvl(p_objvar_14_value(i),objvar_14_value),
	  objvar_15_name = nvl(p_objvar_15_name(i), objvar_15_name),
	  objvar_15_type = nvl(p_objvar_15_type(i), objvar_15_type),
	  objvar_15_value= nvl(p_objvar_15_value(i),objvar_15_value),
	  objvar_16_name = nvl(p_objvar_16_name(i), objvar_16_name),
	  objvar_16_type = nvl(p_objvar_16_type(i), objvar_16_type),
	  objvar_16_value= nvl(p_objvar_16_value(i),objvar_16_value),
	  objvar_17_name = nvl(p_objvar_17_name(i), objvar_17_name),
	  objvar_17_type = nvl(p_objvar_17_type(i), objvar_17_type),
	  objvar_17_value= nvl(p_objvar_17_value(i),objvar_17_value),
	  objvar_18_name = nvl(p_objvar_18_name(i), objvar_18_name),
	  objvar_18_type = nvl(p_objvar_18_type(i), objvar_18_type),
	  objvar_18_value= nvl(p_objvar_18_value(i),objvar_18_value),
	  objvar_19_name = nvl(p_objvar_19_name(i), objvar_19_name),
	  objvar_19_type = nvl(p_objvar_19_type(i), objvar_19_type),
	  objvar_19_value= nvl(p_objvar_19_value(i),objvar_19_value),

	  script_list = nvl(p_script_list(i),script_list)
	  where
	  object_id=p_object_id(i) and
	  (p_deleted(i) = 0 or p_deleted(i) is null);

	  cache_update.delete; -- cleanup - delete VARRAY list

	end;

	procedure add_object ( p_x VAOFNUMBER, p_y VAOFNUMBER, p_z VAOFNUMBER, p_quaternion_w VAOFNUMBER, p_quaternion_x VAOFNUMBER, p_quaternion_y VAOFNUMBER, p_quaternion_z VAOFNUMBER, p_node_x VAOFNUMBER, p_node_y VAOFNUMBER, p_node_z VAOFNUMBER, p_object_template_id VAOFNUMBER, p_type_id VAOFNUMBER, p_scene_id VAOFSTRING, p_controller_type VAOFNUMBER, p_deleted VAOFNUMBER, p_object_name VAOFSTRING, p_volume VAOFNUMBER, p_contained_by VAOFSTRING, p_slot_arrangement VAOFNUMBER, p_player_controlled VAOFSTRING, p_cache_version VAOFNUMBER, p_load_contents VAOFSTRING, p_cash_balance VAOFNUMBER, p_bank_balance VAOFNUMBER, p_complexity VAOFNUMBER, p_name_string_table VAOFSTRING, p_name_string_text VAOFSTRING, p_static_item_name VAOFSTRING, p_static_item_version VAOFNUMBER, p_conversion_id VAOFNUMBER, p_load_with VAOFSTRING,
		p_objvar_0_name VAOFSTRING,p_objvar_0_type VAOFNUMBER,p_objvar_0_value VAOFSTRING,p_objvar_1_name VAOFSTRING,p_objvar_1_type VAOFNUMBER,p_objvar_1_value VAOFSTRING,p_objvar_2_name VAOFSTRING,p_objvar_2_type VAOFNUMBER,p_objvar_2_value VAOFSTRING,p_objvar_3_name VAOFSTRING,p_objvar_3_type VAOFNUMBER,p_objvar_3_value VAOFSTRING,p_objvar_4_name VAOFSTRING,p_objvar_4_type VAOFNUMBER,p_objvar_4_value VAOFSTRING,p_objvar_5_name VAOFSTRING,p_objvar_5_type VAOFNUMBER,p_objvar_5_value VAOFSTRING,p_objvar_6_name VAOFSTRING,p_objvar_6_type VAOFNUMBER,p_objvar_6_value VAOFSTRING,p_objvar_7_name VAOFSTRING,p_objvar_7_type VAOFNUMBER,p_objvar_7_value VAOFSTRING,p_objvar_8_name VAOFSTRING,p_objvar_8_type VAOFNUMBER,p_objvar_8_value VAOFSTRING,p_objvar_9_name VAOFSTRING,p_objvar_9_type VAOFNUMBER,p_objvar_9_value VAOFSTRING, p_objvar_10_name VAOFSTRING,p_objvar_10_type VAOFNUMBER,p_objvar_10_value VAOFSTRING,p_objvar_11_name VAOFSTRING,p_objvar_11_type VAOFNUMBER,p_objvar_11_value VAOFSTRING,p_objvar_12_name VAOFSTRING,p_objvar_12_type VAOFNUMBER,p_objvar_12_value VAOFSTRING,p_objvar_13_name VAOFSTRING,p_objvar_13_type VAOFNUMBER,p_objvar_13_value VAOFSTRING,p_objvar_14_name VAOFSTRING,p_objvar_14_type VAOFNUMBER,p_objvar_14_value VAOFSTRING,p_objvar_15_name VAOFSTRING,p_objvar_15_type VAOFNUMBER,p_objvar_15_value VAOFSTRING,p_objvar_16_name VAOFSTRING,p_objvar_16_type VAOFNUMBER,p_objvar_16_value VAOFSTRING,p_objvar_17_name VAOFSTRING,p_objvar_17_type VAOFNUMBER,p_objvar_17_value VAOFSTRING,p_objvar_18_name VAOFSTRING,p_objvar_18_type VAOFNUMBER,p_objvar_18_value VAOFSTRING,p_objvar_19_name VAOFSTRING,p_objvar_19_type VAOFNUMBER,p_objvar_19_value VAOFSTRING, p_script_list VAOFLONGSTRING, p_object_id VAOFSTRING, p_chunk_size number)
	as

 	p_cache_update NUMBER;

	begin
	    FORALL i IN 1..p_chunk_size
		insert into objects
		(
			x,
			y,
			z,
			quaternion_w,
			quaternion_x,
			quaternion_y,
			quaternion_z,
			node_x,
			node_y,
			node_z,
			object_template_id,
			type_id,
			scene_id,
			controller_type,
			deleted,
			object_name,
			volume,
			contained_by,
			slot_arrangement,
			player_controlled,
			cache_version,
			load_contents,
			cash_balance,
			bank_balance,
			complexity,
			name_string_table,
			name_string_text,
            static_item_name,
            static_item_version,
            conversion_id,
			load_with,

			objvar_0_name,
			objvar_0_type,
			objvar_0_value,
			objvar_1_name,
			objvar_1_type,
			objvar_1_value,
			objvar_2_name,
			objvar_2_type,
			objvar_2_value,
			objvar_3_name,
			objvar_3_type,
			objvar_3_value,
			objvar_4_name,
			objvar_4_type,
			objvar_4_value,
			objvar_5_name,
			objvar_5_type,
			objvar_5_value,
			objvar_6_name,
			objvar_6_type,
			objvar_6_value,
			objvar_7_name,
			objvar_7_type,
			objvar_7_value,
			objvar_8_name,
			objvar_8_type,
			objvar_8_value,
			objvar_9_name,
			objvar_9_type,
			objvar_9_value,

			objvar_10_name,
			objvar_10_type,
			objvar_10_value,
			objvar_11_name,
			objvar_11_type,
			objvar_11_value,
			objvar_12_name,
			objvar_12_type,
			objvar_12_value,
			objvar_13_name,
			objvar_13_type,
			objvar_13_value,
			objvar_14_name,
			objvar_14_type,
			objvar_14_value,
			objvar_15_name,
			objvar_15_type,
			objvar_15_value,
			objvar_16_name,
			objvar_16_type,
			objvar_16_value,
			objvar_17_name,
			objvar_17_type,
			objvar_17_value,
			objvar_18_name,
			objvar_18_type,
			objvar_18_value,
			objvar_19_name,
			objvar_19_type,
			objvar_19_value,

			script_list,

			object_id
		)
		values
		(
			p_x(i),
			p_y(i),
			p_z(i),
			p_quaternion_w(i),
			p_quaternion_x(i),
			p_quaternion_y(i),
			p_quaternion_z(i),
			p_node_x(i),
			p_node_y(i),
			p_node_z(i),
			p_object_template_id(i),
			p_type_id(i),
			p_scene_id(i),
			p_controller_type(i),
			p_deleted(i),
			p_object_name(i),
			p_volume(i),
			p_contained_by(i),
			p_slot_arrangement(i),
			p_player_controlled(i),
			0,
			p_load_contents(i),
			p_cash_balance(i),
			p_bank_balance(i),
			p_complexity(i),
			p_name_string_table(i),
			p_name_string_text(i),
            p_static_item_name(i),
            p_static_item_version(i),
            p_conversion_id(i),
			p_load_with(i),

			p_objvar_0_name(i),
			p_objvar_0_type(i),
			p_objvar_0_value(i),
			p_objvar_1_name(i),
			p_objvar_1_type(i),
			p_objvar_1_value(i),
			p_objvar_2_name(i),
			p_objvar_2_type(i),
			p_objvar_2_value(i),
			p_objvar_3_name(i),
			p_objvar_3_type(i),
			p_objvar_3_value(i),
			p_objvar_4_name(i),
			p_objvar_4_type(i),
			p_objvar_4_value(i),
			p_objvar_5_name(i),
			p_objvar_5_type(i),
			p_objvar_5_value(i),
			p_objvar_6_name(i),
			p_objvar_6_type(i),
			p_objvar_6_value(i),
			p_objvar_7_name(i),
			p_objvar_7_type(i),
			p_objvar_7_value(i),
			p_objvar_8_name(i),
			p_objvar_8_type(i),
			p_objvar_8_value(i),
			p_objvar_9_name(i),
			p_objvar_9_type(i),
			p_objvar_9_value(i),

			p_objvar_10_name(i),
			p_objvar_10_type(i),
			p_objvar_10_value(i),
			p_objvar_11_name(i),
			p_objvar_11_type(i),
			p_objvar_11_value(i),
			p_objvar_12_name(i),
			p_objvar_12_type(i),
			p_objvar_12_value(i),
			p_objvar_13_name(i),
			p_objvar_13_type(i),
			p_objvar_13_value(i),
			p_objvar_14_name(i),
			p_objvar_14_type(i),
			p_objvar_14_value(i),
			p_objvar_15_name(i),
			p_objvar_15_type(i),
			p_objvar_15_value(i),
			p_objvar_16_name(i),
			p_objvar_16_type(i),
			p_objvar_16_value(i),
			p_objvar_17_name(i),
			p_objvar_17_type(i),
			p_objvar_17_value(i),
			p_objvar_18_name(i),
			p_objvar_18_type(i),
			p_objvar_18_value(i),
			p_objvar_19_name(i),
			p_objvar_19_type(i),
			p_objvar_19_value(i),

			p_script_list(i),

			p_object_id(i)
		);

		exception when dup_val_on_index then
			for i in 1..p_chunk_size loop

				if
    			 ((p_x(i) is not null)
			     or (p_y(i) is not null)
			     or (p_z(i) is not null)
			     or (p_quaternion_w(i) is not null)
			     or (p_quaternion_x(i) is not null)
			     or (p_quaternion_y(i) is not null)
			     or (p_quaternion_z(i) is not null)
			     or (p_contained_by(i) is not null)
			     or (p_cache_version(i) is not null))
	      then
			     p_cache_update := 0;
	      else
			     p_cache_update := NULL;
	      end if;

				UPDATE OBJECTS Set
					x = nvl(p_x(i),x),
	  			y = nvl(p_y(i),y),
	  			z = nvl(p_z(i),z),
	  			quaternion_w = nvl(p_quaternion_w(i),quaternion_w),
	  			quaternion_x = nvl(p_quaternion_x(i),quaternion_x),
	  			quaternion_y = nvl(p_quaternion_y(i),quaternion_y),
	  			quaternion_z = nvl(p_quaternion_z(i),quaternion_z),
	  			node_x = nvl(p_node_x(i),node_x),
	  			node_y = nvl(p_node_y(i),node_y),
	  			node_z = nvl(p_node_z(i),node_z),
	  			object_template_id = nvl(p_object_template_id(i),object_template_id),
	  			type_id = nvl(p_type_id(i),type_id),
	  			scene_id = nvl(p_scene_id(i),scene_id),
	  			controller_type = nvl(p_controller_type(i),controller_type),
	  			deleted = nvl(p_deleted(i),deleted),
	  			object_name = nvl(p_object_name(i),object_name),
	  			volume = nvl(p_volume(i),volume),
	  			contained_by = nvl(p_contained_by(i),contained_by),
	  			slot_arrangement = nvl(p_slot_arrangement(i),slot_arrangement),
	  			player_controlled = nvl(p_player_controlled(i),player_controlled),
	  			cache_version = nvl(p_cache_update,cache_version),
	  			load_contents = nvl(p_load_contents(i),load_contents),
	  			cash_balance = nvl(p_cash_balance(i),cash_balance),
	  			bank_balance = nvl(p_bank_balance(i),bank_balance),
	  			complexity = nvl(p_complexity(i),complexity),
	  			name_string_table = nvl(p_name_string_table(i),name_string_table),
	  			name_string_text = nvl(p_name_string_text(i),name_string_text),
                static_item_name = nvl(p_static_item_name(i),static_item_name),
                static_item_version = nvl(p_static_item_version(i),static_item_version),
                conversion_id = nvl(p_conversion_id(i),conversion_id),
	  			load_with = nvl(p_load_with(i),load_with),

	  			objvar_0_name = nvl(p_objvar_0_name(i), objvar_0_name),
	  			objvar_0_type = nvl(p_objvar_0_type(i), objvar_0_type),
	  			objvar_0_value= nvl(p_objvar_0_value(i),objvar_0_value),
	  			objvar_1_name = nvl(p_objvar_1_name(i), objvar_1_name),
	  			objvar_1_type = nvl(p_objvar_1_type(i), objvar_1_type),
	  			objvar_1_value= nvl(p_objvar_1_value(i),objvar_1_value),
	  			objvar_2_name = nvl(p_objvar_2_name(i), objvar_2_name),
	  			objvar_2_type = nvl(p_objvar_2_type(i), objvar_2_type),
	  			objvar_2_value= nvl(p_objvar_2_value(i),objvar_2_value),
	  			objvar_3_name = nvl(p_objvar_3_name(i), objvar_3_name),
	  			objvar_3_type = nvl(p_objvar_3_type(i), objvar_3_type),
	  			objvar_3_value= nvl(p_objvar_3_value(i),objvar_3_value),
	  			objvar_4_name = nvl(p_objvar_4_name(i), objvar_4_name),
	  			objvar_4_type = nvl(p_objvar_4_type(i), objvar_4_type),
	  			objvar_4_value= nvl(p_objvar_4_value(i),objvar_4_value),
	  			objvar_5_name = nvl(p_objvar_5_name(i), objvar_5_name),
	  			objvar_5_type = nvl(p_objvar_5_type(i), objvar_5_type),
	  			objvar_5_value= nvl(p_objvar_5_value(i),objvar_5_value),
	  			objvar_6_name = nvl(p_objvar_6_name(i), objvar_6_name),
	  			objvar_6_type = nvl(p_objvar_6_type(i), objvar_6_type),
	  			objvar_6_value= nvl(p_objvar_6_value(i),objvar_6_value),
	  			objvar_7_name = nvl(p_objvar_7_name(i), objvar_7_name),
	  			objvar_7_type = nvl(p_objvar_7_type(i), objvar_7_type),
	  			objvar_7_value= nvl(p_objvar_7_value(i),objvar_7_value),
	  			objvar_8_name = nvl(p_objvar_8_name(i), objvar_8_name),
	  			objvar_8_type = nvl(p_objvar_8_type(i), objvar_8_type),
	  			objvar_8_value= nvl(p_objvar_8_value(i),objvar_8_value),
	  			objvar_9_name = nvl(p_objvar_9_name(i), objvar_9_name),
	  			objvar_9_type = nvl(p_objvar_9_type(i), objvar_9_type),
	  			objvar_9_value= nvl(p_objvar_9_value(i),objvar_9_value),

				objvar_10_name = nvl(p_objvar_10_name(i), objvar_10_name),
	  			objvar_10_type = nvl(p_objvar_10_type(i), objvar_10_type),
	  			objvar_10_value= nvl(p_objvar_10_value(i),objvar_10_value),
	  			objvar_11_name = nvl(p_objvar_11_name(i), objvar_11_name),
	  			objvar_11_type = nvl(p_objvar_11_type(i), objvar_11_type),
	  			objvar_11_value= nvl(p_objvar_11_value(i),objvar_11_value),
	  			objvar_12_name = nvl(p_objvar_12_name(i), objvar_12_name),
	  			objvar_12_type = nvl(p_objvar_12_type(i), objvar_12_type),
	  			objvar_12_value= nvl(p_objvar_12_value(i),objvar_12_value),
	  			objvar_13_name = nvl(p_objvar_13_name(i), objvar_13_name),
	  			objvar_13_type = nvl(p_objvar_13_type(i), objvar_13_type),
	  			objvar_13_value= nvl(p_objvar_13_value(i),objvar_13_value),
	  			objvar_14_name = nvl(p_objvar_14_name(i), objvar_14_name),
	  			objvar_14_type = nvl(p_objvar_14_type(i), objvar_14_type),
	  			objvar_14_value= nvl(p_objvar_14_value(i),objvar_14_value),
	  			objvar_15_name = nvl(p_objvar_15_name(i), objvar_15_name),
	  			objvar_15_type = nvl(p_objvar_15_type(i), objvar_15_type),
	  			objvar_15_value= nvl(p_objvar_15_value(i),objvar_15_value),
	  			objvar_16_name = nvl(p_objvar_16_name(i), objvar_16_name),
	  			objvar_16_type = nvl(p_objvar_16_type(i), objvar_16_type),
	  			objvar_16_value= nvl(p_objvar_16_value(i),objvar_16_value),
	  			objvar_17_name = nvl(p_objvar_17_name(i), objvar_17_name),
	  			objvar_17_type = nvl(p_objvar_17_type(i), objvar_17_type),
	  			objvar_17_value= nvl(p_objvar_17_value(i),objvar_17_value),
	  			objvar_18_name = nvl(p_objvar_18_name(i), objvar_18_name),
	  			objvar_18_type = nvl(p_objvar_18_type(i), objvar_18_type),
	  			objvar_18_value= nvl(p_objvar_18_value(i),objvar_18_value),
	  			objvar_19_name = nvl(p_objvar_19_name(i), objvar_19_name),
	  			objvar_19_type = nvl(p_objvar_19_type(i), objvar_19_type),
	  			objvar_19_value= nvl(p_objvar_19_value(i),objvar_19_value),

				script_list = nvl(p_script_list(i), script_list)

				WHERE
					object_id=p_object_id(i) and
	  				p_deleted(i) = 0;

				if SQL%ROWCOUNT=0 then
				insert into objects
				(
					x,
					y,
					z,
					quaternion_w,
					quaternion_x,
					quaternion_y,

					quaternion_z,
					node_x,
					node_y,
					node_z,
					object_template_id,
					type_id,
					scene_id,
					controller_type,
					deleted,
					object_name,
					volume,
					contained_by,
					slot_arrangement,
					player_controlled,
					cache_version,
					load_contents,
					cash_balance,
					bank_balance,
					complexity,
					name_string_table,
					name_string_text,
                    static_item_name,
                    static_item_version,
                    conversion_id,
					load_with,

					objvar_0_name,
					objvar_0_type,
					objvar_0_value,
					objvar_1_name,
					objvar_1_type,
					objvar_1_value,
					objvar_2_name,
					objvar_2_type,
					objvar_2_value,
					objvar_3_name,
					objvar_3_type,
					objvar_3_value,
					objvar_4_name,
					objvar_4_type,
					objvar_4_value,
					objvar_5_name,
					objvar_5_type,
					objvar_5_value,
					objvar_6_name,
					objvar_6_type,
					objvar_6_value,
					objvar_7_name,
					objvar_7_type,
					objvar_7_value,
					objvar_8_name,
					objvar_8_type,
					objvar_8_value,
					objvar_9_name,
					objvar_9_type,
					objvar_9_value,

					objvar_10_name,
					objvar_10_type,
					objvar_10_value,
					objvar_11_name,
					objvar_11_type,
					objvar_11_value,
					objvar_12_name,
					objvar_12_type,
					objvar_12_value,
					objvar_13_name,
					objvar_13_type,
					objvar_13_value,
					objvar_14_name,
					objvar_14_type,
					objvar_14_value,
					objvar_15_name,
					objvar_15_type,
					objvar_15_value,
					objvar_16_name,
					objvar_16_type,
					objvar_16_value,
					objvar_17_name,
					objvar_17_type,
					objvar_17_value,
					objvar_18_name,
					objvar_18_type,
					objvar_18_value,
					objvar_19_name,
					objvar_19_type,
					objvar_19_value,

					script_list,

					object_id
				)
				values
				(
					p_x(i),
					p_y(i),
					p_z(i),
					p_quaternion_w(i),
					p_quaternion_x(i),
					p_quaternion_y(i),
					p_quaternion_z(i),
					p_node_x(i),
					p_node_y(i),
					p_node_z(i),
					p_object_template_id(i),
					p_type_id(i),
					p_scene_id(i),
					p_controller_type(i),
					p_deleted(i),
					p_object_name(i),
					p_volume(i),
					p_contained_by(i),
					p_slot_arrangement(i),
					p_player_controlled(i),
					0,
					p_load_contents(i),
					p_cash_balance(i),
					p_bank_balance(i),
					p_complexity(i),
					p_name_string_table(i),
					p_name_string_text(i),
                    p_static_item_name(i),
                    p_static_item_version(i),
                    p_conversion_id(i),
					p_load_with(i),

					p_objvar_0_name(i),
					p_objvar_0_type(i),
					p_objvar_0_value(i),
					p_objvar_1_name(i),
					p_objvar_1_type(i),
					p_objvar_1_value(i),
					p_objvar_2_name(i),
					p_objvar_2_type(i),
					p_objvar_2_value(i),
					p_objvar_3_name(i),
					p_objvar_3_type(i),
					p_objvar_3_value(i),
					p_objvar_4_name(i),
					p_objvar_4_type(i),
					p_objvar_4_value(i),
					p_objvar_5_name(i),
					p_objvar_5_type(i),
					p_objvar_5_value(i),
					p_objvar_6_name(i),
					p_objvar_6_type(i),
					p_objvar_6_value(i),
					p_objvar_7_name(i),
					p_objvar_7_type(i),
					p_objvar_7_value(i),
					p_objvar_8_name(i),
					p_objvar_8_type(i),
					p_objvar_8_value(i),
					p_objvar_9_name(i),
					p_objvar_9_type(i),
					p_objvar_9_value(i),

					p_objvar_10_name(i),
					p_objvar_10_type(i),
					p_objvar_10_value(i),
					p_objvar_11_name(i),
					p_objvar_11_type(i),
					p_objvar_11_value(i),
					p_objvar_12_name(i),
					p_objvar_12_type(i),
					p_objvar_12_value(i),
					p_objvar_13_name(i),
					p_objvar_13_type(i),
					p_objvar_13_value(i),
					p_objvar_14_name(i),
					p_objvar_14_type(i),
					p_objvar_14_value(i),
					p_objvar_15_name(i),
					p_objvar_15_type(i),
					p_objvar_15_value(i),
					p_objvar_16_name(i),
					p_objvar_16_type(i),
					p_objvar_16_value(i),
					p_objvar_17_name(i),
					p_objvar_17_type(i),
					p_objvar_17_value(i),
					p_objvar_18_name(i),
					p_objvar_18_type(i),
					p_objvar_18_value(i),
					p_objvar_19_name(i),
					p_objvar_19_type(i),
					p_objvar_19_value(i),

					p_script_list(i),

					p_object_id(i)
				);

    		end if;
			end loop;
	end;

	procedure remove_object ( p_object_id VAOFSTRING, p_chunk_size number)
	as
		begin

		FORALL i IN 1..p_chunk_size
		delete from objects
		where object_id = p_object_id(i);

	end;

	procedure save_manf_schem_attribute
	(
		p_action number,
		p_object_id objectid,
		p_attribute_type varchar2,
		p_value number
	)
	as
	begin
		if (p_action = 0) then
			delete manf_schematic_attributes
			where object_id = p_object_id
			and attribute_type = p_attribute_type;
		else
			update manf_schematic_attributes
			set value = p_value
			where
				object_id = p_object_id
				and attribute_type = p_attribute_type;

			if (sql%rowcount = 0) then
				insert into manf_schematic_attributes (object_id, attribute_type, value)
				values (p_object_id, p_attribute_type, p_value);
			end if;
		end if;
	end;

	procedure update_property_list
	(
		p_object_id objectid,
		p_list_id number,
		p_operation number,
		p_value varchar2
	)
	as
	begin
		-- Operations:
		--  0=ERASE
		--  1=INSERT
		--  2=CLEAR

		IF p_operation = 0 THEN
			delete from property_lists
			where object_id = p_object_id
			and list_id = p_list_id
			and value = p_value;

		ELSIF p_operation = 1 THEN
			insert into property_lists (object_id, list_id, value)
			values (p_object_id, p_list_id, p_value);

		ELSIF p_operation = 2 THEN
			delete from property_lists
			where object_id = p_object_id
			and list_id = p_list_id;

		ELSE
			raise_application_error(-20000,'Invalid operation code passed to update_command.');

		END IF;

		exception when dup_val_on_index then
			null;
	end;

	procedure update_property_list_batch (p_object_id VAOFSTRING, p_list_id VAOFNUMBER, p_operation number, p_value VAOFSTRING, p_chunk_size number, p_enable_db_logging number )
	as
	begin
		-- Operations:
		--  0=ERASE
		--  1=INSERT
		--  2=CLEAR

	if (p_operation = 0) THEN
		FORALL i IN 1.. p_chunk_size
		delete from property_lists
			where object_id = p_object_id(i)
			and list_id = p_list_id(i)
			and value = p_value(i);

	ELSIF (p_operation = 1) THEN
	FORALL i IN 1.. p_chunk_size
		insert into property_lists (object_id, list_id, value)
			values (p_object_id(i), p_list_id(i), p_value(i));

	ELSIF (p_operation = 2) THEN
	FORALL i IN 1.. p_chunk_size
			delete from property_lists
			where object_id = p_object_id(i)
			and list_id = p_list_id(i);

	ELSE
		raise_application_error(-20000,'Invalid operation code passed to update_command.');

	END IF;

		exception when dup_val_on_index then
				for i in 1..p_chunk_size loop
					begin
						insert into property_lists
						(
			  			property_lists.list_id,
						property_lists.value,
						property_lists.object_id
						)
						VALUES
						(
						p_list_id(i),
						p_value(i),
						p_object_id(i)
						);
					exception when dup_val_on_index then
						if ( p_enable_db_logging > 0 ) then

							db_error_logger.dblogerror( SQLCODE, 'procedure update_property_list_batch: duplicate rows were sent to the property list buffer that resulted in a dup_val_on_index error.');
							if ( p_enable_db_logging > 1 ) then

								db_error_logger.dblogerror_values( 'property_lists', 'object_id' , 'number', p_object_id(i));
								db_error_logger.dblogerror_values( 'property_lists', 'list_id' , 'number', to_char(p_list_id(i)));
								db_error_logger.dblogerror_values( 'property_lists', 'value' , 'varchar2', p_value(i));

							end if;

						else
							NULL;
						end if;
					end;
				end loop;
	end;


	procedure save_armor
	(
		p_object_template varchar2,
		p_effectiveness number,
		p_integrity number,
		p_special_protections varchar2,
		p_encumberance_0 number,
		p_encumberance_1 number,
		p_encumberance_2 number,
		p_encumberance_3 number,
		p_encumberance_4 number,
		p_encumberance_5 number,
		p_encumberance_6 number,
		p_encumberance_7 number,
		p_encumberance_8 number,
		p_layer number,
		p_object_id objectid
	)
	as
	begin
		-- Note: armor always updates all properties
		update armor
		set
			object_template = p_object_template,
			effectiveness = p_effectiveness,
			integrity = p_integrity,
			special_protections = p_special_protections,
			encumberance_0 = p_encumberance_0,
			encumberance_1 = p_encumberance_1,
			encumberance_2 = p_encumberance_2,
			encumberance_3 = p_encumberance_3,
			encumberance_4 = p_encumberance_4,
			encumberance_5 = p_encumberance_5,
			encumberance_6 = p_encumberance_6,
			encumberance_7 = p_encumberance_7,
			encumberance_8 = p_encumberance_8
		where
			layer = p_layer
			and object_id = p_object_id;
	end;

	procedure add_armor
	(
		p_object_template varchar2,
		p_effectiveness number,
		p_integrity number,
		p_special_protections varchar2,
		p_encumberance_0 number,
		p_encumberance_1 number,
		p_encumberance_2 number,
		p_encumberance_3 number,
		p_encumberance_4 number,
		p_encumberance_5 number,
		p_encumberance_6 number,
		p_encumberance_7 number,
		p_encumberance_8 number,
		p_layer number,
		p_object_id objectid
	)
	as
	begin
		insert into armor
		(
			object_template,
			effectiveness,
			integrity,
			special_protections,
			encumberance_0,
			encumberance_1,
			encumberance_2,

			encumberance_3,
			encumberance_4,
			encumberance_5,
			encumberance_6,
			encumberance_7,
			encumberance_8,
			layer,
			object_id
		)
		values
		(
			p_object_template,
			p_effectiveness,
			p_integrity,
			p_special_protections,
			p_encumberance_0,
			p_encumberance_1,
			p_encumberance_2,
			p_encumberance_3,
			p_encumberance_4,
			p_encumberance_5,
			p_encumberance_6,
			p_encumberance_7,
			p_encumberance_8,
			p_layer,
			p_object_id
		);

		exception when dup_val_on_index then
			null;
	end;

	procedure save_location
	(
		p_object_id number,
		p_list_id number,
		p_sequence_number number,
		p_operation number,
		p_name varchar2,
		p_scene varchar2,
		p_x number,
		p_y number,
		p_z number,
		p_radius number
	)
	as
	begin
		-- Operations:
		--  0=INSERT

		--  1=DELETE
		--  2=SET

		IF p_operation = 0 THEN
			insert into location_lists (object_id, list_id, sequence_number, name, scene, x, y, z, radius)
			select p_object_id, p_list_id, p_sequence_number, p_name, p_scene, p_x, p_y, p_z, p_radius
			from dual
			where not exists (select * from location_lists
			where object_id = p_object_id
			and list_id = p_list_id
			and sequence_number = p_sequence_number);

		ELSIF p_operation = 1 THEN
			delete from location_lists
			where object_id = p_object_id
			and list_id = p_list_id
			and sequence_number = p_sequence_number;

			update location_lists
			set sequence_number = sequence_number - 1
			where object_id = p_object_id

			and list_id = p_list_id
			and sequence_number > p_sequence_number;

		ELSIF p_operation = 2 THEN
			update location_lists
			set
				name = p_name,
				scene = p_scene,
				x = p_x,
				y = p_y,
				z = p_z,
				radius = p_radius
			where object_id = p_object_id
			and list_id = p_list_id
			and sequence_number = p_sequence_number;

		ELSE
			raise_application_error(-20000,'Invalid operation code passed to update_skill.');

		END IF;
	end;

	procedure save_experience ( p_points number, p_experience_type varchar2, p_object_id number )
	as
	begin
		update experience_points
		set points = p_points
		where object_id = p_object_id and experience_type = p_experience_type;

		if sql%rowcount = 0 then
			insert into experience_points (object_id, experience_type, points)
			values (p_object_id, p_experience_type, p_points);
		end if;
	end;

	procedure save_battlefield_participants ( p_faction_id number, p_character_object_id number, p_region_object_id number )
	as
	begin
		if (p_faction_id <> 0) then
			update battlefield_participants
			set faction_id = p_faction_id
			where region_object_id = p_region_object_id and character_object_id = p_character_object_id;

			if sql%rowcount = 0 then
				insert into battlefield_participants (region_object_id, character_object_id, faction_id)
				values (p_region_object_id, p_character_object_id, p_faction_id);
			end if;
		else
			delete battlefield_participants
			where region_object_id = p_region_object_id and character_object_id = p_character_object_id;
		end if;
	end;

	function rename_character( p_character_id objectid, p_new_name varchar2, p_normalized_name varchar2) return number
	as
		l_existing_object_with_name objectid;
	begin
		select character_object
		into l_existing_object_with_name
		from players
		where uc_character_name = p_normalized_name;

		if (l_existing_object_with_name = p_character_id) then
		update objects
		set object_name = p_new_name
			where object_id = p_character_id;

		if (sql%rowcount=1) then
			update players
			set uc_character_name = p_normalized_name, character_full_name = p_new_name
			where character_object = p_character_id;

			return 1;
		else
			return 0;
		end if;
		else
			return 0;
		end if;

		exception
			when no_data_found then
				update objects
				set object_name = p_new_name
				where object_id = p_character_id;

				if (sql%rowcount=1) then
					update players
					set uc_character_name = p_normalized_name, character_full_name = p_new_name
					where character_object = p_character_id;

					return 1;
				else
					return 0;
				end if;

			when others then
				return 0;
	end;

	procedure save_waypoint
	(
		p_object_id objectid,
		p_waypoint_id objectid,
		p_appearance_name_crc number,
		p_location_x number,
		p_location_y number,
		p_location_z number,
		p_location_cell number,
		p_location_scene number,
		p_name varchar2,
		p_color number,
		p_active char,
		p_detached char
	)
	as
	begin
		if p_detached='N' then

			update waypoints set
				appearance_name_crc = p_appearance_name_crc,
				location_x = p_location_x,
				location_y = p_location_y,
				location_z = p_location_z,
				location_cell = p_location_cell,
				location_scene = p_location_scene,
				name = p_name,
				color = p_color,
				active = p_active

			where
				waypoint_id = p_waypoint_id;

			if (sql%rowcount=0) then
				insert into waypoints
				(
					object_id,
					waypoint_id,
					appearance_name_crc,
					location_x,
					location_y,
					location_z,

					location_cell,
					location_scene,
					name,
					color,
					active
				)
				values
				(
					p_object_id,
					p_waypoint_id,
					p_appearance_name_crc,
					p_location_x,
					p_location_y,
					p_location_z,
					p_location_cell,
					p_location_scene,
					p_name,
					p_color,
					p_active
				);
			end if;

		else -- p_detached <> 'N'

			delete waypoints
			where waypoint_id = p_waypoint_id;

		end if;
	EXCEPTION
	    WHEN OTHERS THEN
	     BEGIN

	      Db_Error_Logger.dblogerror( SQLCODE, 'procedure save_waypoint: attempting to find numeric overflow error.');

		Db_Error_Logger.dblogerror_values( 'waypoints', 'object_id' , 'number', p_object_id);
		Db_Error_Logger.dblogerror_values( 'waypoints', 'waypoint_id' , 'number', p_waypoint_id);
		Db_Error_Logger.dblogerror_values( 'waypoints', 'appearance_name_crc' , 'number', TO_CHAR(p_appearance_name_crc));
		Db_Error_Logger.dblogerror_values( 'waypoints', 'location_x' , 'number', TO_CHAR(p_location_x));
		Db_Error_Logger.dblogerror_values( 'waypoints', 'location_y' , 'number', TO_CHAR(p_location_y));
		Db_Error_Logger.dblogerror_values( 'waypoints', 'location_z' , 'number', TO_CHAR(p_location_z));
		Db_Error_Logger.dblogerror_values( 'waypoints', 'location_cell' , 'number', TO_CHAR(p_location_cell));
		Db_Error_Logger.dblogerror_values( 'waypoints', 'location_scene' , 'number', TO_CHAR(p_location_scene));
        	Db_Error_Logger.dblogerror_values( 'waypoints', 'name' , 'varchar2', p_name);
		Db_Error_Logger.dblogerror_values( 'waypoints', 'color' , 'char', p_color);
		Db_Error_Logger.dblogerror_values( 'waypoints', 'active' , 'char', p_active);
             EXCEPTION
               WHEN OTHERS THEN
                  NULL;
	     END;
	end;

	procedure save_player_obj( p_object_id VAOFSTRING, p_station_id VAOFNUMBER, p_house_id VAOFSTRING, p_account_num_lots VAOFNUMBER, p_account_is_outcast VAOFSTRING, p_account_cheater_level VAOFNUMBER, p_account_max_lots_adjustment VAOFNUMBER, p_personal_profile_id VAOFSTRING, p_character_profile_id VAOFSTRING, p_skill_title VAOFSTRING, p_born_date VAOFNUMBER, p_played_time VAOFNUMBER, p_force_regen_rate VAOFNUMBER, p_force_power VAOFNUMBER, p_max_force_power VAOFNUMBER, p_active_quests VAOFSTRING, p_completed_quests VAOFSTRING, p_current_quest VAOFNUMBER, p_quests VAOFLONGSTRING, p_role_icon_choice VAOFNUMBER, p_quests2 VAOFLONGSTRING, p_quests3 VAOFLONGSTRING, p_quests4 VAOFLONGSTRING, p_skill_template VAOFSTRING, p_working_skill VAOFSTRING, p_current_gcw_points VAOFNUMBER, p_current_gcw_rating VAOFNUMBER, p_current_pvp_kills VAOFNUMBER, p_lifetime_gcw_points VAOFNUMBER, p_max_gcw_imperial_rating VAOFNUMBER, p_max_gcw_rebel_rating VAOFNUMBER, p_lifetime_pvp_kills VAOFNUMBER, p_next_gcw_rating_calc_time VAOFNUMBER, p_collections VAOFLONGSTRING, p_show_backpack VAOFSTRING, p_show_helmet VAOFSTRING, p_collections2 VAOFLONGSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		update player_objects set
			player_objects.station_id = nvl(p_station_id(i),player_objects.station_id),
			player_objects.personal_profile_id = nvl(p_personal_profile_id(i),player_objects.personal_profile_id),
			player_objects.character_profile_id = nvl(p_character_profile_id(i),player_objects.character_profile_id),
			player_objects.skill_title = nvl(p_skill_title(i),player_objects.skill_title),
			player_objects.born_date = nvl(p_born_date(i),player_objects.born_date),
			player_objects.played_time = nvl(p_played_time(i),player_objects.played_time),
			player_objects.force_regen_rate = nvl(p_force_regen_rate(i),player_objects.force_regen_rate),
			player_objects.force_power = nvl(p_force_power(i),player_objects.force_power),
			player_objects.max_force_power = nvl(p_max_force_power(i),player_objects.max_force_power),
			player_objects.active_quests = nvl(p_active_quests(i),player_objects.active_quests),
			player_objects.completed_quests = nvl(p_completed_quests(i),player_objects.completed_quests),
			player_objects.current_quest = nvl(p_current_quest(i),player_objects.current_quest),
			player_objects.quests = nvl(p_quests(i),player_objects.quests),
			player_objects.role_icon_choice = nvl(p_role_icon_choice(i),player_objects.role_icon_choice),
			player_objects.quests2 = nvl(p_quests2(i),player_objects.quests2),
			player_objects.quests3 = nvl(p_quests3(i),player_objects.quests3),
			player_objects.quests4 = nvl(p_quests4(i),player_objects.quests4),
			player_objects.skill_template = nvl(p_skill_template(i),player_objects.skill_template),
			player_objects.working_skill = nvl(p_working_skill(i),player_objects.working_skill),
			player_objects.current_gcw_points = nvl(p_current_gcw_points(i),player_objects.current_gcw_points),
			player_objects.current_gcw_rating = nvl(p_current_gcw_rating(i),player_objects.current_gcw_rating),
			player_objects.current_pvp_kills = nvl(p_current_pvp_kills(i),player_objects.current_pvp_kills),
			player_objects.lifetime_gcw_points = nvl(p_lifetime_gcw_points(i),player_objects.lifetime_gcw_points),
			player_objects.max_gcw_imperial_rating = nvl(p_max_gcw_imperial_rating(i),player_objects.max_gcw_imperial_rating),
			player_objects.max_gcw_rebel_rating = nvl(p_max_gcw_rebel_rating(i),player_objects.max_gcw_rebel_rating),
			player_objects.lifetime_pvp_kills = nvl(p_lifetime_pvp_kills(i),player_objects.lifetime_pvp_kills),
			player_objects.next_gcw_rating_calc_time = nvl(p_next_gcw_rating_calc_time(i),player_objects.next_gcw_rating_calc_time),
			player_objects.collections = nvl(p_collections(i),player_objects.collections),
			player_objects.show_backpack = nvl(p_show_backpack(i),player_objects.show_backpack),
			player_objects.show_helmet = nvl(p_show_helmet(i),player_objects.show_helmet),
			player_objects.collections2 = nvl(p_collections2(i),player_objects.collections2),
			num_lots = nvl(p_account_num_lots(i), num_lots)
		where
			player_objects.object_id=p_object_id(i);

		FOR i IN 1.. p_chunk_size
		LOOP
			if (p_station_id(i) is not null) then
				begin
					insert into accounts (station_id, is_outcast, cheater_level)
					values (p_station_id(i), 0,0);

					exception when dup_val_on_index then
					null;
				end;
			end if;
		end LOOP;

		FORALL i IN 1..p_chunk_size
		update accounts
		set
			is_outcast = nvl(p_account_is_outcast(i), is_outcast),
			cheater_level = nvl(p_account_cheater_level(i), cheater_level),
			max_lots_adjustment = nvl(p_account_max_lots_adjustment(i), max_lots_adjustment),
			house_id = nvl(p_house_id(i), house_id)
		where
			station_id = (select station_id from player_objects where object_id = p_object_id(i));

	end;

	procedure add_player_obj( p_object_id VAOFSTRING, p_station_id VAOFNUMBER, p_house_id VAOFSTRING, p_account_num_lots VAOFNUMBER, p_account_is_outcast VAOFSTRING, p_account_cheater_level VAOFNUMBER, p_account_max_lots_adjustment VAOFNUMBER, p_personal_profile_id VAOFSTRING, p_character_profile_id VAOFSTRING, p_skill_title VAOFSTRING, p_born_date VAOFNUMBER, p_played_time VAOFNUMBER, p_force_regen_rate VAOFNUMBER, p_force_power VAOFNUMBER, p_max_force_power VAOFNUMBER, p_active_quests VAOFSTRING, p_completed_quests VAOFSTRING, p_current_quest VAOFNUMBER, p_quests VAOFLONGSTRING, p_role_icon_choice VAOFNUMBER, p_quests2 VAOFLONGSTRING, p_quests3 VAOFLONGSTRING, p_quests4 VAOFLONGSTRING, p_skill_template VAOFSTRING, p_working_skill VAOFSTRING, p_current_gcw_points VAOFNUMBER, p_current_gcw_rating VAOFNUMBER, p_current_pvp_kills VAOFNUMBER, p_lifetime_gcw_points VAOFNUMBER, p_max_gcw_imperial_rating VAOFNUMBER, p_max_gcw_rebel_rating VAOFNUMBER, p_lifetime_pvp_kills VAOFNUMBER, p_next_gcw_rating_calc_time VAOFNUMBER, p_collections VAOFLONGSTRING, p_show_backpack VAOFSTRING, p_show_helmet VAOFSTRING, p_collections2 VAOFLONGSTRING, p_chunk_size number )
	as
	begin

		FORALL i IN 1..p_chunk_size
		insert into player_objects
		(
			player_objects.station_id,
			player_objects.personal_profile_id,
			player_objects.character_profile_id,
			player_objects.skill_title,
			player_objects.born_date,
			player_objects.played_time,
			player_objects.force_regen_rate,
			player_objects.force_power,
			player_objects.max_force_power,
			player_objects.num_lots,
			player_objects.object_id,
			player_objects.active_quests,
			player_objects.completed_quests,
			player_objects.current_quest,
			player_objects.quests,
			player_objects.role_icon_choice,
			player_objects.quests2,
			player_objects.quests3,
			player_objects.quests4,
			player_objects.skill_template,
			player_objects.working_skill,
			player_objects.current_gcw_points,
			player_objects.current_gcw_rating,
			player_objects.current_pvp_kills,
			player_objects.lifetime_gcw_points,
			player_objects.max_gcw_imperial_rating,
			player_objects.max_gcw_rebel_rating,
			player_objects.lifetime_pvp_kills,
			player_objects.next_gcw_rating_calc_time,
			player_objects.collections,
			player_objects.show_backpack,
			player_objects.show_helmet,
			player_objects.collections2
		)
		VALUES
		(
			p_station_id(i),
			p_personal_profile_id(i),
			p_character_profile_id(i),
			p_skill_title(i),
			p_born_date(i),
			p_played_time(i),
			p_force_regen_rate(i),
			p_force_power(i),
			p_max_force_power(i),
			p_account_num_lots(i),
			p_object_id(i),
			p_active_quests(i),
			p_completed_quests(i),
			p_current_quest(i),
			p_quests(i),
			p_role_icon_choice(i),
			p_quests2(i),
			p_quests3(i),
			p_quests4(i),
			p_skill_template(i),
			p_working_skill(i),
			p_current_gcw_points(i),
			p_current_gcw_rating(i),
			p_current_pvp_kills(i),
			p_lifetime_gcw_points(i),
			p_max_gcw_imperial_rating(i),
			p_max_gcw_rebel_rating(i),
			p_lifetime_pvp_kills(i),
			p_next_gcw_rating_calc_time(i),
			p_collections(i),
			p_show_backpack(i),
			p_show_helmet(i),
			p_collections2(i)
		);

		FOR i IN 1.. p_chunk_size
		LOOP
			if (p_station_id(i) is not null) then
				begin
					insert into accounts (station_id, is_outcast, cheater_level, max_lots_adjustment, house_id)
					values (p_station_id(i), p_account_is_outcast(i), p_account_cheater_level(i), p_account_max_lots_adjustment(i), p_house_id(i));

					exception when dup_val_on_index then
						null;
				end;
			end if;
		end LOOP;

		exception when dup_val_on_index then
			for i in 1..p_chunk_size loop
				UPDATE player_objects Set
					player_objects.station_id = nvl(p_station_id(i),player_objects.station_id),
					player_objects.personal_profile_id = nvl(p_personal_profile_id(i),player_objects.personal_profile_id),
					player_objects.character_profile_id = nvl(p_character_profile_id(i),player_objects.character_profile_id),
					player_objects.skill_title = nvl(p_skill_title(i),player_objects.skill_title),
					player_objects.born_date = nvl(p_born_date(i),player_objects.born_date),
					player_objects.played_time = nvl(p_played_time(i),player_objects.played_time),
					player_objects.force_regen_rate = nvl(p_force_regen_rate(i),player_objects.force_regen_rate),
					player_objects.force_power = nvl(p_force_power(i),player_objects.force_power),
					player_objects.max_force_power = nvl(p_max_force_power(i),player_objects.max_force_power),
					player_objects.num_lots = nvl(p_account_num_lots(i), num_lots),
					player_objects.active_quests = nvl(p_active_quests(i),player_objects.active_quests),
					player_objects.completed_quests = nvl(p_completed_quests(i),player_objects.completed_quests),
					player_objects.current_quest = nvl(p_current_quest(i),player_objects.current_quest),
					player_objects.quests = nvl(p_quests(i),player_objects.quests),
					player_objects.role_icon_choice = nvl(p_role_icon_choice(i),player_objects.role_icon_choice),
					player_objects.quests2 = nvl(p_quests(i),player_objects.quests2),
					player_objects.quests3 = nvl(p_quests(i),player_objects.quests3),
					player_objects.quests4 = nvl(p_quests(i),player_objects.quests4),
					player_objects.skill_template = nvl(p_skill_template(i),player_objects.skill_template),
					player_objects.working_skill = nvl(p_working_skill(i),player_objects.working_skill),
					player_objects.current_gcw_points = nvl(p_current_gcw_points(i),player_objects.current_gcw_points),
					player_objects.current_gcw_rating = nvl(p_current_gcw_rating(i),player_objects.current_gcw_rating),
					player_objects.current_pvp_kills = nvl(p_current_pvp_kills(i),player_objects.current_pvp_kills),
					player_objects.lifetime_gcw_points = nvl(p_lifetime_gcw_points(i),player_objects.lifetime_gcw_points),
					player_objects.max_gcw_imperial_rating = nvl(p_max_gcw_imperial_rating(i),player_objects.max_gcw_imperial_rating),
					player_objects.max_gcw_rebel_rating = nvl(p_max_gcw_rebel_rating(i),player_objects.max_gcw_rebel_rating),
					player_objects.lifetime_pvp_kills = nvl(p_lifetime_pvp_kills(i),player_objects.lifetime_pvp_kills),
					player_objects.next_gcw_rating_calc_time = nvl(p_next_gcw_rating_calc_time(i),player_objects.next_gcw_rating_calc_time),
					player_objects.collections = nvl(p_collections(i),player_objects.collections),
					player_objects.show_backpack = nvl(p_show_backpack(i),player_objects.show_backpack),
					player_objects.show_helmet = nvl(p_show_helmet(i),player_objects.show_helmet),
					player_objects.collections2 = nvl(p_collections2(i),player_objects.collections2)
				where
					player_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into player_objects
					(
					player_objects.station_id,
					player_objects.personal_profile_id,
					player_objects.character_profile_id,
					player_objects.skill_title,
					player_objects.born_date,
					player_objects.played_time,
					player_objects.force_regen_rate,
					player_objects.force_power,
					player_objects.max_force_power,
					player_objects.num_lots,
					player_objects.object_id,
					player_objects.active_quests,
					player_objects.completed_quests,
					player_objects.current_quest,
					player_objects.quests,
					player_objects.role_icon_choice,
					player_objects.quests2,
					player_objects.quests3,
					player_objects.quests4,
					player_objects.skill_template,
					player_objects.working_skill,
					player_objects.current_gcw_points,
					player_objects.current_gcw_rating,
					player_objects.current_pvp_kills,
					player_objects.lifetime_gcw_points,
					player_objects.max_gcw_imperial_rating,
					player_objects.max_gcw_rebel_rating,
					player_objects.lifetime_pvp_kills,
					player_objects.next_gcw_rating_calc_time,
					player_objects.collections,
					player_objects.show_backpack,
					player_objects.show_helmet,
					player_objects.collections2
					)
					VALUES
					(
					p_station_id(i),
					p_personal_profile_id(i),
					p_character_profile_id(i),
					p_skill_title(i),
					p_born_date(i),
					p_played_time(i),
					p_force_regen_rate(i),
					p_force_power(i),
					p_max_force_power(i),
					p_account_num_lots(i),
					p_object_id(i),
					p_active_quests(i),
					p_completed_quests(i),
					p_current_quest(i),
					p_quests(i),
					p_role_icon_choice(i),
					p_quests2(i),
					p_quests3(i),
					p_quests4(i),
					p_skill_template(i),
					p_working_skill(i),
					p_current_gcw_points(i),
					p_current_gcw_rating(i),
					p_current_pvp_kills(i),
					p_lifetime_gcw_points(i),
					p_max_gcw_imperial_rating(i),
					p_max_gcw_rebel_rating(i),
					p_lifetime_pvp_kills(i),
					p_next_gcw_rating_calc_time(i),
					p_collections(i),
					p_show_backpack(i),
					p_show_helmet(i),
					p_collections2(i)
					);
				end if;
			end loop;

			FOR i IN 1.. p_chunk_size
			LOOP
				if (p_station_id(i) is not null) then
					begin
						insert into accounts (station_id, is_outcast, cheater_level, max_lots_adjustment, house_id)
						values (p_station_id(i), p_account_is_outcast(i), p_account_cheater_level(i), p_account_max_lots_adjustment(i), p_house_id(i));

						exception when dup_val_on_index then
							null;
					end;
				end if;
			end LOOP;
	end;

	procedure remove_player_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete player_objects
		where
			object_id=p_object_id(i);
	end;

	procedure delete_demand_container( p_object_id VAOFSTRING, p_reason VAOFNUMBER, p_chunk_size number )
	as
		l_delete_reason number;
	begin
		select reason_code
		into l_delete_reason
		from delete_reasons
		where tag='ContainerDeleted';

		FOR i IN 1.. p_chunk_size
		LOOP
			update objects
			set deleted = decode(p_reason(i),0,l_delete_reason,p_reason(i)), -- use reason if specified, otherwise use 'ContainerDeleted' if it is 0
			load_with = null,
			deleted_date = sysdate
			where load_with = p_object_id(i);
		end LOOP;
	end;

	procedure save_resource_type(p_resource_id VAOFSTRING, p_resource_name VAOFSTRING, p_resource_class VAOFSTRING, p_attributes VAOFSTRING, p_fractal_seeds VAOFSTRING, p_depleted_timestamp VAOFNUMBER, p_chunk_size number)
	as
	begin
		forall i in 1..p_chunk_size
		insert into resource_types
		(
			resource_id,
			resource_name,
			resource_class,
			attributes,
			fractal_seeds,
			depleted_timestamp
		)
		values
		(
			p_resource_id(i),
			p_resource_name(i),
			p_resource_class(i),
			p_attributes(i),
			p_fractal_seeds(i),
			p_depleted_timestamp(i)
		);

		exception when dup_val_on_index then
			for i in 1..p_chunk_size loop
				update resource_types set
					resource_name = p_resource_name(i),
					resource_class = p_resource_class(i),
					attributes = p_attributes(i),
					fractal_seeds = p_fractal_seeds(i),
					depleted_timestamp = p_depleted_timestamp(i)
				where
					resource_id=p_resource_id(i);

				if SQL%ROWCOUNT=0 then
					insert into resource_types
					(
						resource_id,
						resource_name,
						resource_class,
						attributes,
						fractal_seeds,
						depleted_timestamp
					)
					values
					(
						p_resource_id(i),
						p_resource_name(i),
						p_resource_class(i),
						p_attributes(i),
						p_fractal_seeds(i),
						p_depleted_timestamp(i)
					);
				end if;
			end loop;
	end;

	procedure save_bounty_hunter_target(p_object_id VAOFSTRING, p_target_id VAOFSTRING, p_chunk_size number)
	as
	begin
		forall i in 1..p_chunk_size
		insert into bounty_hunter_targets
		(
			object_id,
			target_id
		)
		values
		(
			p_object_id(i),
			p_target_id(i)
		);

		delete bounty_hunter_targets
		where target_id = 0;

	exception when dup_val_on_index then
		begin
			for i in 1..p_chunk_size loop
				update bounty_hunter_targets set
					target_id = p_target_id(i)
				where
					object_id = p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into bounty_hunter_targets
					(
						object_id,
						target_id
					)
					values
					(
						p_object_id(i),
						p_target_id(i)
					);
				end if;
			end loop;

			delete bounty_hunter_targets
			where target_id = 0;
		end;
	end;

	function subtract_money_from_object(p_object_id number, p_amount number) return char
	as
		new_bank_balance number;
		new_cash_balance number;
	begin
		select bank_balance, cash_balance
		into new_bank_balance, new_cash_balance
		from objects
		where object_id = p_object_id
		for update;

		if (new_bank_balance + new_cash_balance < p_amount) then
			return 'N';
		end if;

		new_bank_balance := new_bank_balance - p_amount;
		if (new_bank_balance < 0) then
			new_cash_balance := new_cash_balance + new_bank_balance;
			new_bank_balance := 0;
		end if;

		update objects
		set bank_balance = new_bank_balance, cash_balance = new_cash_balance
		where object_id = p_object_id;

		return 'Y';
	exception
		when others then
			return 'N';
	end;

-- GENERATED PLSQL FOLLOWS
-- generated by makepersister.pl

	procedure save_battlefield_marker_obj( p_object_id VAOFSTRING, p_region_name VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update battlefield_marker_objects set
			battlefield_marker_objects.region_name = nvl(p_region_name(i),battlefield_marker_objects.region_name)
		where
			battlefield_marker_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update battlefield_marker_objects set
					battlefield_marker_objects.region_name = nvl(p_region_name(i),battlefield_marker_objects.region_name)
					where
					battlefield_marker_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_battlefield_marker_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_battlefield_marker_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_battlefield_marker_obj','region_name','varchar2',p_region_name(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_battlefield_marker_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_battlefield_marker_obj( p_object_id VAOFSTRING, p_region_name VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into battlefield_marker_objects
		(
			battlefield_marker_objects.region_name,
			battlefield_marker_objects.object_id
		)
		VALUES
		(
			p_region_name(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_battlefield_marker_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE battlefield_marker_objects Set
					battlefield_marker_objects.region_name = nvl(p_region_name(i),battlefield_marker_objects.region_name)
				where
					battlefield_marker_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into battlefield_marker_objects
					(
					battlefield_marker_objects.region_name,
					battlefield_marker_objects.object_id
					)
					VALUES
					(
					p_region_name(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into battlefield_marker_objects
			(
				battlefield_marker_objects.region_name,
				battlefield_marker_objects.object_id
			)
			VALUES
			(
				p_region_name(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_battlefield_marker_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_battlefield_marker_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_battlefield_marker_obj','region_name','varchar2',p_region_name(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_battlefield_marker_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_battlefield_marker_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete battlefield_marker_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_building_obj( p_object_id VAOFSTRING, p_maintenance_cost VAOFNUMBER, p_time_last_checked VAOFNUMBER, p_is_public VAOFSTRING, p_city_id VAOFNUMBER, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update building_objects set
			building_objects.maintenance_cost = nvl(p_maintenance_cost(i),building_objects.maintenance_cost),
			building_objects.time_last_checked = nvl(p_time_last_checked(i),building_objects.time_last_checked),
			building_objects.is_public = nvl(p_is_public(i),building_objects.is_public),
			building_objects.city_id = nvl(p_city_id(i),building_objects.city_id)
		where
			building_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update building_objects set
					building_objects.maintenance_cost = nvl(p_maintenance_cost(i),building_objects.maintenance_cost),
					building_objects.time_last_checked = nvl(p_time_last_checked(i),building_objects.time_last_checked),
					building_objects.is_public = nvl(p_is_public(i),building_objects.is_public),
					building_objects.city_id = nvl(p_city_id(i),building_objects.city_id)
					where
					building_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_building_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_building_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_building_obj','maintenance_cost','int',to_char(p_maintenance_cost(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_building_obj','time_last_checked','float',to_char(p_time_last_checked(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_building_obj','is_public','char',p_is_public(m_error_index));
								db_error_logger.dblogerror_values('persister.save_building_obj','city_id','int',to_char(p_city_id(m_error_index)));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_building_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_building_obj( p_object_id VAOFSTRING, p_maintenance_cost VAOFNUMBER, p_time_last_checked VAOFNUMBER, p_is_public VAOFSTRING, p_city_id VAOFNUMBER, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into building_objects
		(
			building_objects.maintenance_cost,
			building_objects.time_last_checked,
			building_objects.is_public,
			building_objects.city_id,
			building_objects.object_id
		)
		VALUES
		(
			p_maintenance_cost(i),
			p_time_last_checked(i),
			p_is_public(i),
			p_city_id(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_building_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE building_objects Set
					building_objects.maintenance_cost = nvl(p_maintenance_cost(i),building_objects.maintenance_cost),
					building_objects.time_last_checked = nvl(p_time_last_checked(i),building_objects.time_last_checked),
					building_objects.is_public = nvl(p_is_public(i),building_objects.is_public),
					building_objects.city_id = nvl(p_city_id(i),building_objects.city_id)
				where
					building_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into building_objects
					(
					building_objects.maintenance_cost,
					building_objects.time_last_checked,
					building_objects.is_public,
					building_objects.city_id,
					building_objects.object_id
					)
					VALUES
					(
					p_maintenance_cost(i),
					p_time_last_checked(i),
					p_is_public(i),
					p_city_id(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into building_objects
			(
				building_objects.maintenance_cost,
				building_objects.time_last_checked,
				building_objects.is_public,
				building_objects.city_id,
				building_objects.object_id
			)
			VALUES
			(
				p_maintenance_cost(i),
				p_time_last_checked(i),
				p_is_public(i),
				p_city_id(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_building_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_building_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_building_obj','maintenance_cost','int',to_char(p_maintenance_cost(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_building_obj','time_last_checked','float',to_char(p_time_last_checked(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_building_obj','is_public','char',p_is_public(m_error_index));
						db_error_logger.dblogerror_values('persister.add_building_obj','city_id','int',to_char(p_city_id(m_error_index)));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_building_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_building_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete building_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_cell_obj( p_object_id VAOFSTRING, p_cell_number VAOFNUMBER, p_is_public VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update cell_objects set
			cell_objects.cell_number = nvl(p_cell_number(i),cell_objects.cell_number),
			cell_objects.is_public = nvl(p_is_public(i),cell_objects.is_public)
		where
			cell_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update cell_objects set
					cell_objects.cell_number = nvl(p_cell_number(i),cell_objects.cell_number),
					cell_objects.is_public = nvl(p_is_public(i),cell_objects.is_public)
					where
					cell_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_cell_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_cell_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_cell_obj','cell_number','int',to_char(p_cell_number(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_cell_obj','is_public','char',p_is_public(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_cell_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_cell_obj( p_object_id VAOFSTRING, p_cell_number VAOFNUMBER, p_is_public VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into cell_objects
		(
			cell_objects.cell_number,
			cell_objects.is_public,
			cell_objects.object_id
		)
		VALUES
		(
			p_cell_number(i),
			p_is_public(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_cell_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE cell_objects Set
					cell_objects.cell_number = nvl(p_cell_number(i),cell_objects.cell_number),
					cell_objects.is_public = nvl(p_is_public(i),cell_objects.is_public)
				where
					cell_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into cell_objects
					(
					cell_objects.cell_number,
					cell_objects.is_public,
					cell_objects.object_id
					)
					VALUES
					(
					p_cell_number(i),
					p_is_public(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into cell_objects
			(
				cell_objects.cell_number,
				cell_objects.is_public,
				cell_objects.object_id
			)
			VALUES
			(
				p_cell_number(i),
				p_is_public(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_cell_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_cell_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_cell_obj','cell_number','int',to_char(p_cell_number(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_cell_obj','is_public','char',p_is_public(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_cell_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_cell_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete cell_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_city_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		null;
	end;

	procedure add_city_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into city_objects
		(
			city_objects.object_id
		)
		VALUES
		(
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_city_obj : dup_val_on_index error.');
			END IF;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into city_objects
			(
				city_objects.object_id
			)
			VALUES
			(
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_city_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_city_obj','object_id','number',p_object_id(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_city_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_city_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		null;
	end;

	procedure save_creature_obj( p_object_id VAOFSTRING, p_scale_factor VAOFNUMBER, p_states VAOFNUMBER, p_posture VAOFNUMBER, p_shock_wounds VAOFNUMBER, p_master_id VAOFSTRING, p_rank VAOFNUMBER, p_base_walk_speed VAOFNUMBER, p_base_run_speed VAOFNUMBER, p_attribute_0 VAOFNUMBER, p_attribute_1 VAOFNUMBER, p_attribute_2 VAOFNUMBER, p_attribute_3 VAOFNUMBER, p_attribute_4 VAOFNUMBER, p_attribute_5 VAOFNUMBER, p_attribute_6 VAOFNUMBER, p_attribute_7 VAOFNUMBER, p_attribute_8 VAOFNUMBER, p_attribute_9 VAOFNUMBER, p_attribute_10 VAOFNUMBER, p_attribute_11 VAOFNUMBER, p_attribute_12 VAOFNUMBER, p_attribute_13 VAOFNUMBER, p_attribute_14 VAOFNUMBER, p_attribute_15 VAOFNUMBER, p_attribute_16 VAOFNUMBER, p_attribute_17 VAOFNUMBER, p_attribute_18 VAOFNUMBER, p_attribute_19 VAOFNUMBER, p_attribute_20 VAOFNUMBER, p_attribute_21 VAOFNUMBER, p_attribute_22 VAOFNUMBER, p_attribute_23 VAOFNUMBER, p_attribute_24 VAOFNUMBER, p_attribute_25 VAOFNUMBER, p_attribute_26 VAOFNUMBER, p_persisted_buffs VAOFSTRING, p_ws_x VAOFNUMBER, p_ws_y VAOFNUMBER, p_ws_z VAOFNUMBER, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update creature_objects set
			creature_objects.scale_factor = nvl(p_scale_factor(i),creature_objects.scale_factor),
			creature_objects.states = nvl(p_states(i),creature_objects.states),
			creature_objects.posture = nvl(p_posture(i),creature_objects.posture),
			creature_objects.shock_wounds = nvl(p_shock_wounds(i),creature_objects.shock_wounds),
			creature_objects.master_id = nvl(p_master_id(i),creature_objects.master_id),
			creature_objects.rank = nvl(p_rank(i),creature_objects.rank),
			creature_objects.base_walk_speed = nvl(p_base_walk_speed(i),creature_objects.base_walk_speed),
			creature_objects.base_run_speed = nvl(p_base_run_speed(i),creature_objects.base_run_speed),
			creature_objects.attribute_0 = nvl(p_attribute_0(i),creature_objects.attribute_0),
			creature_objects.attribute_1 = nvl(p_attribute_1(i),creature_objects.attribute_1),
			creature_objects.attribute_2 = nvl(p_attribute_2(i),creature_objects.attribute_2),
			creature_objects.attribute_3 = nvl(p_attribute_3(i),creature_objects.attribute_3),
			creature_objects.attribute_4 = nvl(p_attribute_4(i),creature_objects.attribute_4),
			creature_objects.attribute_5 = nvl(p_attribute_5(i),creature_objects.attribute_5),
			creature_objects.attribute_6 = nvl(p_attribute_6(i),creature_objects.attribute_6),
			creature_objects.attribute_7 = nvl(p_attribute_7(i),creature_objects.attribute_7),
			creature_objects.attribute_8 = nvl(p_attribute_8(i),creature_objects.attribute_8),
			creature_objects.attribute_9 = nvl(p_attribute_9(i),creature_objects.attribute_9),
			creature_objects.attribute_10 = nvl(p_attribute_10(i),creature_objects.attribute_10),
			creature_objects.attribute_11 = nvl(p_attribute_11(i),creature_objects.attribute_11),
			creature_objects.attribute_12 = nvl(p_attribute_12(i),creature_objects.attribute_12),
			creature_objects.attribute_13 = nvl(p_attribute_13(i),creature_objects.attribute_13),
			creature_objects.attribute_14 = nvl(p_attribute_14(i),creature_objects.attribute_14),
			creature_objects.attribute_15 = nvl(p_attribute_15(i),creature_objects.attribute_15),
			creature_objects.attribute_16 = nvl(p_attribute_16(i),creature_objects.attribute_16),
			creature_objects.attribute_17 = nvl(p_attribute_17(i),creature_objects.attribute_17),
			creature_objects.attribute_18 = nvl(p_attribute_18(i),creature_objects.attribute_18),
			creature_objects.attribute_19 = nvl(p_attribute_19(i),creature_objects.attribute_19),
			creature_objects.attribute_20 = nvl(p_attribute_20(i),creature_objects.attribute_20),
			creature_objects.attribute_21 = nvl(p_attribute_21(i),creature_objects.attribute_21),
			creature_objects.attribute_22 = nvl(p_attribute_22(i),creature_objects.attribute_22),
			creature_objects.attribute_23 = nvl(p_attribute_23(i),creature_objects.attribute_23),
			creature_objects.attribute_24 = nvl(p_attribute_24(i),creature_objects.attribute_24),
			creature_objects.attribute_25 = nvl(p_attribute_25(i),creature_objects.attribute_25),
			creature_objects.attribute_26 = nvl(p_attribute_26(i),creature_objects.attribute_26),
			creature_objects.persisted_buffs = nvl(p_persisted_buffs(i),creature_objects.persisted_buffs),
			creature_objects.ws_x = nvl(p_ws_x(i),creature_objects.ws_x),
			creature_objects.ws_y = nvl(p_ws_y(i),creature_objects.ws_y),
			creature_objects.ws_z = nvl(p_ws_z(i),creature_objects.ws_z)
		where
			creature_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update creature_objects set
					creature_objects.scale_factor = nvl(p_scale_factor(i),creature_objects.scale_factor),
					creature_objects.states = nvl(p_states(i),creature_objects.states),
					creature_objects.posture = nvl(p_posture(i),creature_objects.posture),
					creature_objects.shock_wounds = nvl(p_shock_wounds(i),creature_objects.shock_wounds),
					creature_objects.master_id = nvl(p_master_id(i),creature_objects.master_id),
					creature_objects.rank = nvl(p_rank(i),creature_objects.rank),
					creature_objects.base_walk_speed = nvl(p_base_walk_speed(i),creature_objects.base_walk_speed),
					creature_objects.base_run_speed = nvl(p_base_run_speed(i),creature_objects.base_run_speed),
					creature_objects.attribute_0 = nvl(p_attribute_0(i),creature_objects.attribute_0),
					creature_objects.attribute_1 = nvl(p_attribute_1(i),creature_objects.attribute_1),
					creature_objects.attribute_2 = nvl(p_attribute_2(i),creature_objects.attribute_2),
					creature_objects.attribute_3 = nvl(p_attribute_3(i),creature_objects.attribute_3),
					creature_objects.attribute_4 = nvl(p_attribute_4(i),creature_objects.attribute_4),
					creature_objects.attribute_5 = nvl(p_attribute_5(i),creature_objects.attribute_5),
					creature_objects.attribute_6 = nvl(p_attribute_6(i),creature_objects.attribute_6),
					creature_objects.attribute_7 = nvl(p_attribute_7(i),creature_objects.attribute_7),
					creature_objects.attribute_8 = nvl(p_attribute_8(i),creature_objects.attribute_8),
					creature_objects.attribute_9 = nvl(p_attribute_9(i),creature_objects.attribute_9),
					creature_objects.attribute_10 = nvl(p_attribute_10(i),creature_objects.attribute_10),
					creature_objects.attribute_11 = nvl(p_attribute_11(i),creature_objects.attribute_11),
					creature_objects.attribute_12 = nvl(p_attribute_12(i),creature_objects.attribute_12),
					creature_objects.attribute_13 = nvl(p_attribute_13(i),creature_objects.attribute_13),
					creature_objects.attribute_14 = nvl(p_attribute_14(i),creature_objects.attribute_14),
					creature_objects.attribute_15 = nvl(p_attribute_15(i),creature_objects.attribute_15),
					creature_objects.attribute_16 = nvl(p_attribute_16(i),creature_objects.attribute_16),
					creature_objects.attribute_17 = nvl(p_attribute_17(i),creature_objects.attribute_17),
					creature_objects.attribute_18 = nvl(p_attribute_18(i),creature_objects.attribute_18),
					creature_objects.attribute_19 = nvl(p_attribute_19(i),creature_objects.attribute_19),
					creature_objects.attribute_20 = nvl(p_attribute_20(i),creature_objects.attribute_20),
					creature_objects.attribute_21 = nvl(p_attribute_21(i),creature_objects.attribute_21),
					creature_objects.attribute_22 = nvl(p_attribute_22(i),creature_objects.attribute_22),
					creature_objects.attribute_23 = nvl(p_attribute_23(i),creature_objects.attribute_23),
					creature_objects.attribute_24 = nvl(p_attribute_24(i),creature_objects.attribute_24),
					creature_objects.attribute_25 = nvl(p_attribute_25(i),creature_objects.attribute_25),
					creature_objects.attribute_26 = nvl(p_attribute_26(i),creature_objects.attribute_26),
					creature_objects.persisted_buffs = nvl(p_persisted_buffs(i),creature_objects.persisted_buffs),
					creature_objects.ws_x = nvl(p_ws_x(i),creature_objects.ws_x),
					creature_objects.ws_y = nvl(p_ws_y(i),creature_objects.ws_y),
					creature_objects.ws_z = nvl(p_ws_z(i),creature_objects.ws_z)
					where
					creature_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_creature_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_creature_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_creature_obj','scale_factor','float',to_char(p_scale_factor(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','states','int',to_char(p_states(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','posture','int',to_char(p_posture(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','shock_wounds','int',to_char(p_shock_wounds(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','master_id','number',p_master_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_creature_obj','rank','int',to_char(p_rank(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','base_walk_speed','float',to_char(p_base_walk_speed(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','base_run_speed','float',to_char(p_base_run_speed(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_0','int',to_char(p_attribute_0(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_1','int',to_char(p_attribute_1(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_2','int',to_char(p_attribute_2(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_3','int',to_char(p_attribute_3(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_4','int',to_char(p_attribute_4(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_5','int',to_char(p_attribute_5(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_6','int',to_char(p_attribute_6(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_7','int',to_char(p_attribute_7(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_8','int',to_char(p_attribute_8(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_9','int',to_char(p_attribute_9(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_10','int',to_char(p_attribute_10(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_11','int',to_char(p_attribute_11(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_12','int',to_char(p_attribute_12(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_13','int',to_char(p_attribute_13(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_14','int',to_char(p_attribute_14(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_15','int',to_char(p_attribute_15(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_16','int',to_char(p_attribute_16(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_17','int',to_char(p_attribute_17(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_18','int',to_char(p_attribute_18(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_19','int',to_char(p_attribute_19(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_20','int',to_char(p_attribute_20(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_21','int',to_char(p_attribute_21(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_22','int',to_char(p_attribute_22(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_23','int',to_char(p_attribute_23(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_24','int',to_char(p_attribute_24(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_25','int',to_char(p_attribute_25(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','attribute_26','int',to_char(p_attribute_26(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','persisted_buffs','varchar2',p_persisted_buffs(m_error_index));

								db_error_logger.dblogerror_values('persister.save_creature_obj','ws_x','float',to_char(p_ws_x(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','ws_y','float',to_char(p_ws_y(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_creature_obj','ws_z','float',to_char(p_ws_z(m_error_index)));

							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_creature_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_creature_obj( p_object_id VAOFSTRING, p_scale_factor VAOFNUMBER, p_states VAOFNUMBER, p_posture VAOFNUMBER, p_shock_wounds VAOFNUMBER, p_master_id VAOFSTRING, p_rank VAOFNUMBER, p_base_walk_speed VAOFNUMBER, p_base_run_speed VAOFNUMBER, p_attribute_0 VAOFNUMBER, p_attribute_1 VAOFNUMBER, p_attribute_2 VAOFNUMBER, p_attribute_3 VAOFNUMBER, p_attribute_4 VAOFNUMBER, p_attribute_5 VAOFNUMBER, p_attribute_6 VAOFNUMBER, p_attribute_7 VAOFNUMBER, p_attribute_8 VAOFNUMBER, p_attribute_9 VAOFNUMBER, p_attribute_10 VAOFNUMBER, p_attribute_11 VAOFNUMBER, p_attribute_12 VAOFNUMBER, p_attribute_13 VAOFNUMBER, p_attribute_14 VAOFNUMBER, p_attribute_15 VAOFNUMBER, p_attribute_16 VAOFNUMBER, p_attribute_17 VAOFNUMBER, p_attribute_18 VAOFNUMBER, p_attribute_19 VAOFNUMBER, p_attribute_20 VAOFNUMBER, p_attribute_21 VAOFNUMBER, p_attribute_22 VAOFNUMBER, p_attribute_23 VAOFNUMBER, p_attribute_24 VAOFNUMBER, p_attribute_25 VAOFNUMBER, p_attribute_26 VAOFNUMBER, p_persisted_buffs VAOFSTRING, p_ws_x VAOFNUMBER, p_ws_y VAOFNUMBER, p_ws_z VAOFNUMBER, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into creature_objects
		(
			creature_objects.scale_factor,
			creature_objects.states,
			creature_objects.posture,
			creature_objects.shock_wounds,
			creature_objects.master_id,
			creature_objects.rank,
			creature_objects.base_walk_speed,
			creature_objects.base_run_speed,
			creature_objects.attribute_0,
			creature_objects.attribute_1,
			creature_objects.attribute_2,
			creature_objects.attribute_3,
			creature_objects.attribute_4,
			creature_objects.attribute_5,
			creature_objects.attribute_6,
			creature_objects.attribute_7,
			creature_objects.attribute_8,
			creature_objects.attribute_9,
			creature_objects.attribute_10,
			creature_objects.attribute_11,
			creature_objects.attribute_12,
			creature_objects.attribute_13,
			creature_objects.attribute_14,
			creature_objects.attribute_15,
			creature_objects.attribute_16,
			creature_objects.attribute_17,
			creature_objects.attribute_18,
			creature_objects.attribute_19,
			creature_objects.attribute_20,
			creature_objects.attribute_21,
			creature_objects.attribute_22,
			creature_objects.attribute_23,
			creature_objects.attribute_24,
			creature_objects.attribute_25,
			creature_objects.attribute_26,
			creature_objects.persisted_buffs,
			creature_objects.object_id,
			creature_objects.ws_x,
			creature_objects.ws_y,
			creature_objects.ws_z
		)
		VALUES
		(
			p_scale_factor(i),
			p_states(i),
			p_posture(i),
			p_shock_wounds(i),
			p_master_id(i),
			p_rank(i),
			p_base_walk_speed(i),
			p_base_run_speed(i),
			p_attribute_0(i),
			p_attribute_1(i),
			p_attribute_2(i),
			p_attribute_3(i),
			p_attribute_4(i),
			p_attribute_5(i),
			p_attribute_6(i),
			p_attribute_7(i),
			p_attribute_8(i),
			p_attribute_9(i),
			p_attribute_10(i),
			p_attribute_11(i),
			p_attribute_12(i),
			p_attribute_13(i),
			p_attribute_14(i),
			p_attribute_15(i),
			p_attribute_16(i),
			p_attribute_17(i),
			p_attribute_18(i),
			p_attribute_19(i),
			p_attribute_20(i),
			p_attribute_21(i),
			p_attribute_22(i),
			p_attribute_23(i),
			p_attribute_24(i),
			p_attribute_25(i),
			p_attribute_26(i),
			p_persisted_buffs(i),
			p_object_id(i),
			NULL,
			NULL,
			NULL
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_creature_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE creature_objects Set
					creature_objects.scale_factor = nvl(p_scale_factor(i),creature_objects.scale_factor),
					creature_objects.states = nvl(p_states(i),creature_objects.states),
					creature_objects.posture = nvl(p_posture(i),creature_objects.posture),
					creature_objects.shock_wounds = nvl(p_shock_wounds(i),creature_objects.shock_wounds),
					creature_objects.master_id = nvl(p_master_id(i),creature_objects.master_id),
					creature_objects.rank = nvl(p_rank(i),creature_objects.rank),
					creature_objects.base_walk_speed = nvl(p_base_walk_speed(i),creature_objects.base_walk_speed),
					creature_objects.base_run_speed = nvl(p_base_run_speed(i),creature_objects.base_run_speed),
					creature_objects.attribute_0 = nvl(p_attribute_0(i),creature_objects.attribute_0),
					creature_objects.attribute_1 = nvl(p_attribute_1(i),creature_objects.attribute_1),
					creature_objects.attribute_2 = nvl(p_attribute_2(i),creature_objects.attribute_2),
					creature_objects.attribute_3 = nvl(p_attribute_3(i),creature_objects.attribute_3),
					creature_objects.attribute_4 = nvl(p_attribute_4(i),creature_objects.attribute_4),
					creature_objects.attribute_5 = nvl(p_attribute_5(i),creature_objects.attribute_5),
					creature_objects.attribute_6 = nvl(p_attribute_6(i),creature_objects.attribute_6),
					creature_objects.attribute_7 = nvl(p_attribute_7(i),creature_objects.attribute_7),
					creature_objects.attribute_8 = nvl(p_attribute_8(i),creature_objects.attribute_8),
					creature_objects.attribute_9 = nvl(p_attribute_9(i),creature_objects.attribute_9),
					creature_objects.attribute_10 = nvl(p_attribute_10(i),creature_objects.attribute_10),
					creature_objects.attribute_11 = nvl(p_attribute_11(i),creature_objects.attribute_11),
					creature_objects.attribute_12 = nvl(p_attribute_12(i),creature_objects.attribute_12),
					creature_objects.attribute_13 = nvl(p_attribute_13(i),creature_objects.attribute_13),
					creature_objects.attribute_14 = nvl(p_attribute_14(i),creature_objects.attribute_14),
					creature_objects.attribute_15 = nvl(p_attribute_15(i),creature_objects.attribute_15),
					creature_objects.attribute_16 = nvl(p_attribute_16(i),creature_objects.attribute_16),
					creature_objects.attribute_17 = nvl(p_attribute_17(i),creature_objects.attribute_17),
					creature_objects.attribute_18 = nvl(p_attribute_18(i),creature_objects.attribute_18),
					creature_objects.attribute_19 = nvl(p_attribute_19(i),creature_objects.attribute_19),
					creature_objects.attribute_20 = nvl(p_attribute_20(i),creature_objects.attribute_20),
					creature_objects.attribute_21 = nvl(p_attribute_21(i),creature_objects.attribute_21),
					creature_objects.attribute_22 = nvl(p_attribute_22(i),creature_objects.attribute_22),
					creature_objects.attribute_23 = nvl(p_attribute_23(i),creature_objects.attribute_23),
					creature_objects.attribute_24 = nvl(p_attribute_24(i),creature_objects.attribute_24),
					creature_objects.attribute_25 = nvl(p_attribute_25(i),creature_objects.attribute_25),
					creature_objects.attribute_26 = nvl(p_attribute_26(i),creature_objects.attribute_26),
					creature_objects.persisted_buffs = nvl(p_persisted_buffs(i),creature_objects.persisted_buffs),
					creature_objects.ws_x = nvl(p_ws_x(i),creature_objects.ws_x),
					creature_objects.ws_y = nvl(p_ws_y(i),creature_objects.ws_y),
					creature_objects.ws_z = nvl(p_ws_z(i),creature_objects.ws_z)
				where
					creature_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into creature_objects
					(
					creature_objects.scale_factor,
					creature_objects.states,
					creature_objects.posture,
					creature_objects.shock_wounds,
					creature_objects.master_id,
					creature_objects.rank,
					creature_objects.base_walk_speed,
					creature_objects.base_run_speed,
					creature_objects.attribute_0,
					creature_objects.attribute_1,
					creature_objects.attribute_2,
					creature_objects.attribute_3,
					creature_objects.attribute_4,
					creature_objects.attribute_5,
					creature_objects.attribute_6,
					creature_objects.attribute_7,
					creature_objects.attribute_8,
					creature_objects.attribute_9,
					creature_objects.attribute_10,
					creature_objects.attribute_11,
					creature_objects.attribute_12,
					creature_objects.attribute_13,
					creature_objects.attribute_14,
					creature_objects.attribute_15,
					creature_objects.attribute_16,
					creature_objects.attribute_17,
					creature_objects.attribute_18,
					creature_objects.attribute_19,
					creature_objects.attribute_20,
					creature_objects.attribute_21,
					creature_objects.attribute_22,
					creature_objects.attribute_23,
					creature_objects.attribute_24,
					creature_objects.attribute_25,
					creature_objects.attribute_26,
					creature_objects.persisted_buffs,
					creature_objects.object_id,
					creature_objects.ws_x,
					creature_objects.ws_y,
					creature_objects.ws_z
					)
					VALUES
					(
					p_scale_factor(i),
					p_states(i),
					p_posture(i),
					p_shock_wounds(i),
					p_master_id(i),
					p_rank(i),
					p_base_walk_speed(i),
					p_base_run_speed(i),
					p_attribute_0(i),
					p_attribute_1(i),
					p_attribute_2(i),
					p_attribute_3(i),
					p_attribute_4(i),
					p_attribute_5(i),
					p_attribute_6(i),
					p_attribute_7(i),
					p_attribute_8(i),
					p_attribute_9(i),
					p_attribute_10(i),
					p_attribute_11(i),
					p_attribute_12(i),
					p_attribute_13(i),
					p_attribute_14(i),
					p_attribute_15(i),
					p_attribute_16(i),
					p_attribute_17(i),
					p_attribute_18(i),
					p_attribute_19(i),
					p_attribute_20(i),
					p_attribute_21(i),
					p_attribute_22(i),
					p_attribute_23(i),
					p_attribute_24(i),
					p_attribute_25(i),
					p_attribute_26(i),
					p_persisted_buffs(i),
					p_object_id(i),
					NULL,
					NULL,
					NULL
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into creature_objects
			(
				creature_objects.scale_factor,
				creature_objects.states,
				creature_objects.posture,
				creature_objects.shock_wounds,
				creature_objects.master_id,
				creature_objects.rank,
				creature_objects.base_walk_speed,
				creature_objects.base_run_speed,
				creature_objects.attribute_0,
				creature_objects.attribute_1,
				creature_objects.attribute_2,
				creature_objects.attribute_3,
				creature_objects.attribute_4,
				creature_objects.attribute_5,
				creature_objects.attribute_6,
				creature_objects.attribute_7,
				creature_objects.attribute_8,
				creature_objects.attribute_9,
				creature_objects.attribute_10,
				creature_objects.attribute_11,
				creature_objects.attribute_12,
				creature_objects.attribute_13,
				creature_objects.attribute_14,
				creature_objects.attribute_15,
				creature_objects.attribute_16,
				creature_objects.attribute_17,
				creature_objects.attribute_18,
				creature_objects.attribute_19,
				creature_objects.attribute_20,
				creature_objects.attribute_21,
				creature_objects.attribute_22,
				creature_objects.attribute_23,
				creature_objects.attribute_24,
				creature_objects.attribute_25,
				creature_objects.attribute_26,
				creature_objects.persisted_buffs,
				creature_objects.object_id,
				creature_objects.ws_x,
				creature_objects.ws_y,
				creature_objects.ws_z
			)
			VALUES
			(
				p_scale_factor(i),
				p_states(i),
				p_posture(i),
				p_shock_wounds(i),
				p_master_id(i),
				p_rank(i),
				p_base_walk_speed(i),
				p_base_run_speed(i),
				p_attribute_0(i),
				p_attribute_1(i),
				p_attribute_2(i),
				p_attribute_3(i),
				p_attribute_4(i),
				p_attribute_5(i),
				p_attribute_6(i),
				p_attribute_7(i),
				p_attribute_8(i),
				p_attribute_9(i),
				p_attribute_10(i),
				p_attribute_11(i),
				p_attribute_12(i),
				p_attribute_13(i),
				p_attribute_14(i),
				p_attribute_15(i),
				p_attribute_16(i),
				p_attribute_17(i),
				p_attribute_18(i),
				p_attribute_19(i),
				p_attribute_20(i),
				p_attribute_21(i),
				p_attribute_22(i),
				p_attribute_23(i),
				p_attribute_24(i),
				p_attribute_25(i),
				p_attribute_26(i),
				p_persisted_buffs(i),
				p_object_id(i),
				NULL,
				NULL,
				NULL
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_creature_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_creature_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_creature_obj','scale_factor','float',to_char(p_scale_factor(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','states','int',to_char(p_states(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','posture','int',to_char(p_posture(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','shock_wounds','int',to_char(p_shock_wounds(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','master_id','number',p_master_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_creature_obj','rank','int',to_char(p_rank(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','base_walk_speed','float',to_char(p_base_walk_speed(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','base_run_speed','float',to_char(p_base_run_speed(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_0','int',to_char(p_attribute_0(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_1','int',to_char(p_attribute_1(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_2','int',to_char(p_attribute_2(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_3','int',to_char(p_attribute_3(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_4','int',to_char(p_attribute_4(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_5','int',to_char(p_attribute_5(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_6','int',to_char(p_attribute_6(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_7','int',to_char(p_attribute_7(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_8','int',to_char(p_attribute_8(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_9','int',to_char(p_attribute_9(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_10','int',to_char(p_attribute_10(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_11','int',to_char(p_attribute_11(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_12','int',to_char(p_attribute_12(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_13','int',to_char(p_attribute_13(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_14','int',to_char(p_attribute_14(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_15','int',to_char(p_attribute_15(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_16','int',to_char(p_attribute_16(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_17','int',to_char(p_attribute_17(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_18','int',to_char(p_attribute_18(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_19','int',to_char(p_attribute_19(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_20','int',to_char(p_attribute_20(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_21','int',to_char(p_attribute_21(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_22','int',to_char(p_attribute_22(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_23','int',to_char(p_attribute_23(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_24','int',to_char(p_attribute_24(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_25','int',to_char(p_attribute_25(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','attribute_26','int',to_char(p_attribute_26(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_creature_obj','persisted_buffs','varchar2',p_persisted_buffs(m_error_index));
						db_error_logger.dblogerror_values('persister.add_creature_obj','ws_x','float',p_ws_x(m_error_index));
						db_error_logger.dblogerror_values('persister.add_creature_obj','ws_y','float',p_ws_y(m_error_index));
						db_error_logger.dblogerror_values('persister.add_creature_obj','ws_z','float',p_ws_z(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_creature_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_creature_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete creature_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_factory_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		null;
	end;

	procedure add_factory_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into factory_objects
		(
			factory_objects.object_id
		)
		VALUES
		(
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_factory_obj : dup_val_on_index error.');
			END IF;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into factory_objects
			(
				factory_objects.object_id
			)
			VALUES
			(
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_factory_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_factory_obj','object_id','number',p_object_id(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_factory_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_factory_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		null;
	end;

	procedure save_guild_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		null;
	end;

	procedure add_guild_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into guild_objects
		(
			guild_objects.object_id
		)
		VALUES
		(
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_guild_obj : dup_val_on_index error.');
			END IF;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into guild_objects
			(
				guild_objects.object_id
			)
			VALUES
			(
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_guild_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_guild_obj','object_id','number',p_object_id(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_guild_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_guild_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		null;
	end;

	procedure save_harvester_inst_obj( p_object_id VAOFSTRING, p_installed_efficiency VAOFNUMBER, p_max_extraction_rate VAOFNUMBER, p_current_extraction_rate VAOFNUMBER, p_max_hopper_amount VAOFNUMBER, p_hopper_resource VAOFSTRING, p_hopper_amount VAOFNUMBER, p_resource_type VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update harvester_installation_objects set
			harvester_installation_objects.installed_efficiency = nvl(p_installed_efficiency(i),harvester_installation_objects.installed_efficiency),
			harvester_installation_objects.max_extraction_rate = nvl(p_max_extraction_rate(i),harvester_installation_objects.max_extraction_rate),
			harvester_installation_objects.current_extraction_rate = nvl(p_current_extraction_rate(i),harvester_installation_objects.current_extraction_rate),
			harvester_installation_objects.max_hopper_amount = nvl(p_max_hopper_amount(i),harvester_installation_objects.max_hopper_amount),
			harvester_installation_objects.hopper_resource = nvl(p_hopper_resource(i),harvester_installation_objects.hopper_resource),
			harvester_installation_objects.hopper_amount = nvl(p_hopper_amount(i),harvester_installation_objects.hopper_amount),
			harvester_installation_objects.resource_type = nvl(p_resource_type(i),harvester_installation_objects.resource_type)
		where
			harvester_installation_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update harvester_installation_objects set
					harvester_installation_objects.installed_efficiency = nvl(p_installed_efficiency(i),harvester_installation_objects.installed_efficiency),
					harvester_installation_objects.max_extraction_rate = nvl(p_max_extraction_rate(i),harvester_installation_objects.max_extraction_rate),
					harvester_installation_objects.current_extraction_rate = nvl(p_current_extraction_rate(i),harvester_installation_objects.current_extraction_rate),
					harvester_installation_objects.max_hopper_amount = nvl(p_max_hopper_amount(i),harvester_installation_objects.max_hopper_amount),
					harvester_installation_objects.hopper_resource = nvl(p_hopper_resource(i),harvester_installation_objects.hopper_resource),
					harvester_installation_objects.hopper_amount = nvl(p_hopper_amount(i),harvester_installation_objects.hopper_amount),
					harvester_installation_objects.resource_type = nvl(p_resource_type(i),harvester_installation_objects.resource_type)
					where
					harvester_installation_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_harvester_inst_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_harvester_inst_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_harvester_inst_obj','installed_efficiency','float',to_char(p_installed_efficiency(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_harvester_inst_obj','max_extraction_rate','int',to_char(p_max_extraction_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_harvester_inst_obj','current_extraction_rate','float',to_char(p_current_extraction_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_harvester_inst_obj','max_hopper_amount','int',to_char(p_max_hopper_amount(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_harvester_inst_obj','hopper_resource','number',p_hopper_resource(m_error_index));
								db_error_logger.dblogerror_values('persister.save_harvester_inst_obj','hopper_amount','float',to_char(p_hopper_amount(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_harvester_inst_obj','resource_type','number',p_resource_type(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_harvester_inst_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_harvester_inst_obj( p_object_id VAOFSTRING, p_installed_efficiency VAOFNUMBER, p_max_extraction_rate VAOFNUMBER, p_current_extraction_rate VAOFNUMBER, p_max_hopper_amount VAOFNUMBER, p_hopper_resource VAOFSTRING, p_hopper_amount VAOFNUMBER, p_resource_type VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into harvester_installation_objects
		(
			harvester_installation_objects.installed_efficiency,
			harvester_installation_objects.max_extraction_rate,
			harvester_installation_objects.current_extraction_rate,
			harvester_installation_objects.max_hopper_amount,
			harvester_installation_objects.hopper_resource,
			harvester_installation_objects.hopper_amount,
			harvester_installation_objects.resource_type,
			harvester_installation_objects.object_id
		)
		VALUES
		(
			p_installed_efficiency(i),
			p_max_extraction_rate(i),
			p_current_extraction_rate(i),
			p_max_hopper_amount(i),
			p_hopper_resource(i),
			p_hopper_amount(i),
			p_resource_type(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_harvester_inst_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE harvester_installation_objects Set
					harvester_installation_objects.installed_efficiency = nvl(p_installed_efficiency(i),harvester_installation_objects.installed_efficiency),
					harvester_installation_objects.max_extraction_rate = nvl(p_max_extraction_rate(i),harvester_installation_objects.max_extraction_rate),
					harvester_installation_objects.current_extraction_rate = nvl(p_current_extraction_rate(i),harvester_installation_objects.current_extraction_rate),
					harvester_installation_objects.max_hopper_amount = nvl(p_max_hopper_amount(i),harvester_installation_objects.max_hopper_amount),
					harvester_installation_objects.hopper_resource = nvl(p_hopper_resource(i),harvester_installation_objects.hopper_resource),
					harvester_installation_objects.hopper_amount = nvl(p_hopper_amount(i),harvester_installation_objects.hopper_amount),
					harvester_installation_objects.resource_type = nvl(p_resource_type(i),harvester_installation_objects.resource_type)
				where
					harvester_installation_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into harvester_installation_objects
					(
					harvester_installation_objects.installed_efficiency,
					harvester_installation_objects.max_extraction_rate,
					harvester_installation_objects.current_extraction_rate,
					harvester_installation_objects.max_hopper_amount,
					harvester_installation_objects.hopper_resource,
					harvester_installation_objects.hopper_amount,
					harvester_installation_objects.resource_type,
					harvester_installation_objects.object_id
					)
					VALUES
					(
					p_installed_efficiency(i),
					p_max_extraction_rate(i),
					p_current_extraction_rate(i),
					p_max_hopper_amount(i),
					p_hopper_resource(i),
					p_hopper_amount(i),
					p_resource_type(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into harvester_installation_objects
			(
				harvester_installation_objects.installed_efficiency,
				harvester_installation_objects.max_extraction_rate,
				harvester_installation_objects.current_extraction_rate,
				harvester_installation_objects.max_hopper_amount,
				harvester_installation_objects.hopper_resource,
				harvester_installation_objects.hopper_amount,
				harvester_installation_objects.resource_type,
				harvester_installation_objects.object_id
			)
			VALUES
			(
				p_installed_efficiency(i),
				p_max_extraction_rate(i),
				p_current_extraction_rate(i),
				p_max_hopper_amount(i),
				p_hopper_resource(i),
				p_hopper_amount(i),
				p_resource_type(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_harvester_inst_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_harvester_inst_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_harvester_inst_obj','installed_efficiency','float',to_char(p_installed_efficiency(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_harvester_inst_obj','max_extraction_rate','int',to_char(p_max_extraction_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_harvester_inst_obj','current_extraction_rate','float',to_char(p_current_extraction_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_harvester_inst_obj','max_hopper_amount','int',to_char(p_max_hopper_amount(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_harvester_inst_obj','hopper_resource','number',p_hopper_resource(m_error_index));
						db_error_logger.dblogerror_values('persister.add_harvester_inst_obj','hopper_amount','float',to_char(p_hopper_amount(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_harvester_inst_obj','resource_type','number',p_resource_type(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_harvester_inst_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_harvester_inst_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete harvester_installation_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_installation_obj( p_object_id VAOFSTRING, p_installation_type VAOFNUMBER, p_activated VAOFSTRING, p_tick_count VAOFNUMBER, p_activate_start_time VAOFNUMBER, p_power VAOFNUMBER, p_power_rate VAOFNUMBER, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update installation_objects set
			installation_objects.installation_type = nvl(p_installation_type(i),installation_objects.installation_type),
			installation_objects.activated = nvl(p_activated(i),installation_objects.activated),
			installation_objects.tick_count = nvl(p_tick_count(i),installation_objects.tick_count),
			installation_objects.activate_start_time = nvl(p_activate_start_time(i),installation_objects.activate_start_time),
			installation_objects.power = nvl(p_power(i),installation_objects.power),
			installation_objects.power_rate = nvl(p_power_rate(i),installation_objects.power_rate)
		where
			installation_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update installation_objects set
					installation_objects.installation_type = nvl(p_installation_type(i),installation_objects.installation_type),
					installation_objects.activated = nvl(p_activated(i),installation_objects.activated),
					installation_objects.tick_count = nvl(p_tick_count(i),installation_objects.tick_count),
					installation_objects.activate_start_time = nvl(p_activate_start_time(i),installation_objects.activate_start_time),
					installation_objects.power = nvl(p_power(i),installation_objects.power),
					installation_objects.power_rate = nvl(p_power_rate(i),installation_objects.power_rate)
					where
					installation_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_installation_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_installation_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_installation_obj','installation_type','int',to_char(p_installation_type(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_installation_obj','activated','char',p_activated(m_error_index));
								db_error_logger.dblogerror_values('persister.save_installation_obj','tick_count','float',to_char(p_tick_count(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_installation_obj','activate_start_time','float',to_char(p_activate_start_time(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_installation_obj','power','float',to_char(p_power(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_installation_obj','power_rate','float',to_char(p_power_rate(m_error_index)));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_installation_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_installation_obj( p_object_id VAOFSTRING, p_installation_type VAOFNUMBER, p_activated VAOFSTRING, p_tick_count VAOFNUMBER, p_activate_start_time VAOFNUMBER, p_power VAOFNUMBER, p_power_rate VAOFNUMBER, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into installation_objects
		(
			installation_objects.installation_type,
			installation_objects.activated,
			installation_objects.tick_count,
			installation_objects.activate_start_time,
			installation_objects.power,
			installation_objects.power_rate,
			installation_objects.object_id
		)
		VALUES
		(
			p_installation_type(i),
			p_activated(i),
			p_tick_count(i),
			p_activate_start_time(i),
			p_power(i),
			p_power_rate(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_installation_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE installation_objects Set
					installation_objects.installation_type = nvl(p_installation_type(i),installation_objects.installation_type),
					installation_objects.activated = nvl(p_activated(i),installation_objects.activated),
					installation_objects.tick_count = nvl(p_tick_count(i),installation_objects.tick_count),
					installation_objects.activate_start_time = nvl(p_activate_start_time(i),installation_objects.activate_start_time),
					installation_objects.power = nvl(p_power(i),installation_objects.power),
					installation_objects.power_rate = nvl(p_power_rate(i),installation_objects.power_rate)
				where
					installation_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into installation_objects
					(
					installation_objects.installation_type,
					installation_objects.activated,
					installation_objects.tick_count,
					installation_objects.activate_start_time,
					installation_objects.power,
					installation_objects.power_rate,
					installation_objects.object_id
					)
					VALUES
					(
					p_installation_type(i),
					p_activated(i),
					p_tick_count(i),
					p_activate_start_time(i),
					p_power(i),
					p_power_rate(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into installation_objects
			(
				installation_objects.installation_type,
				installation_objects.activated,
				installation_objects.tick_count,
				installation_objects.activate_start_time,
				installation_objects.power,
				installation_objects.power_rate,
				installation_objects.object_id
			)
			VALUES
			(
				p_installation_type(i),
				p_activated(i),
				p_tick_count(i),
				p_activate_start_time(i),
				p_power(i),
				p_power_rate(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_installation_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_installation_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_installation_obj','installation_type','int',to_char(p_installation_type(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_installation_obj','activated','char',p_activated(m_error_index));
						db_error_logger.dblogerror_values('persister.add_installation_obj','tick_count','float',to_char(p_tick_count(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_installation_obj','activate_start_time','float',to_char(p_activate_start_time(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_installation_obj','power','float',to_char(p_power(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_installation_obj','power_rate','float',to_char(p_power_rate(m_error_index)));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_installation_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_installation_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete installation_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_intangible_obj( p_object_id VAOFSTRING, p_count VAOFNUMBER, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update intangible_objects set
			intangible_objects.count = nvl(p_count(i),intangible_objects.count)
		where
			intangible_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update intangible_objects set
					intangible_objects.count = nvl(p_count(i),intangible_objects.count)
					where
					intangible_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_intangible_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_intangible_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_intangible_obj','count','int',to_char(p_count(m_error_index)));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_intangible_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_intangible_obj( p_object_id VAOFSTRING, p_count VAOFNUMBER, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into intangible_objects
		(
			intangible_objects.count,
			intangible_objects.object_id
		)
		VALUES
		(
			p_count(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_intangible_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE intangible_objects Set
					intangible_objects.count = nvl(p_count(i),intangible_objects.count)
				where
					intangible_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into intangible_objects
					(
					intangible_objects.count,
					intangible_objects.object_id
					)
					VALUES
					(
					p_count(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into intangible_objects
			(
				intangible_objects.count,
				intangible_objects.object_id
			)
			VALUES
			(
				p_count(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_intangible_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_intangible_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_intangible_obj','count','int',to_char(p_count(m_error_index)));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_intangible_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_intangible_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete intangible_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_manf_schematic_obj( p_object_id VAOFSTRING, p_creator_id VAOFSTRING, p_creator_name VAOFSTRING, p_items_per_container VAOFNUMBER, p_manufacture_time VAOFNUMBER, p_draft_schematic VAOFNUMBER, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update manf_schematic_objects set
			manf_schematic_objects.creator_id = nvl(p_creator_id(i),manf_schematic_objects.creator_id),
			manf_schematic_objects.creator_name = nvl(p_creator_name(i),manf_schematic_objects.creator_name),
			manf_schematic_objects.items_per_container = nvl(p_items_per_container(i),manf_schematic_objects.items_per_container),
			manf_schematic_objects.manufacture_time = nvl(p_manufacture_time(i),manf_schematic_objects.manufacture_time),
			manf_schematic_objects.draft_schematic = nvl(p_draft_schematic(i),manf_schematic_objects.draft_schematic)
		where
			manf_schematic_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update manf_schematic_objects set
					manf_schematic_objects.creator_id = nvl(p_creator_id(i),manf_schematic_objects.creator_id),
					manf_schematic_objects.creator_name = nvl(p_creator_name(i),manf_schematic_objects.creator_name),
					manf_schematic_objects.items_per_container = nvl(p_items_per_container(i),manf_schematic_objects.items_per_container),
					manf_schematic_objects.manufacture_time = nvl(p_manufacture_time(i),manf_schematic_objects.manufacture_time),
					manf_schematic_objects.draft_schematic = nvl(p_draft_schematic(i),manf_schematic_objects.draft_schematic)
					where
					manf_schematic_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_manf_schematic_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_manf_schematic_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_manf_schematic_obj','creator_id','number',p_creator_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_manf_schematic_obj','creator_name','varchar2',p_creator_name(m_error_index));
								db_error_logger.dblogerror_values('persister.save_manf_schematic_obj','items_per_container','int',to_char(p_items_per_container(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_manf_schematic_obj','manufacture_time','float',to_char(p_manufacture_time(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_manf_schematic_obj','draft_schematic','int',to_char(p_draft_schematic(m_error_index)));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_manf_schematic_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_manf_schematic_obj( p_object_id VAOFSTRING, p_creator_id VAOFSTRING, p_creator_name VAOFSTRING, p_items_per_container VAOFNUMBER, p_manufacture_time VAOFNUMBER, p_draft_schematic VAOFNUMBER, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into manf_schematic_objects
		(
			manf_schematic_objects.creator_id,
			manf_schematic_objects.creator_name,
			manf_schematic_objects.items_per_container,
			manf_schematic_objects.manufacture_time,
			manf_schematic_objects.draft_schematic,
			manf_schematic_objects.object_id
		)
		VALUES
		(
			p_creator_id(i),
			p_creator_name(i),
			p_items_per_container(i),
			p_manufacture_time(i),
			p_draft_schematic(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_manf_schematic_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE manf_schematic_objects Set
					manf_schematic_objects.creator_id = nvl(p_creator_id(i),manf_schematic_objects.creator_id),
					manf_schematic_objects.creator_name = nvl(p_creator_name(i),manf_schematic_objects.creator_name),
					manf_schematic_objects.items_per_container = nvl(p_items_per_container(i),manf_schematic_objects.items_per_container),
					manf_schematic_objects.manufacture_time = nvl(p_manufacture_time(i),manf_schematic_objects.manufacture_time),
					manf_schematic_objects.draft_schematic = nvl(p_draft_schematic(i),manf_schematic_objects.draft_schematic)
				where
					manf_schematic_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into manf_schematic_objects
					(
					manf_schematic_objects.creator_id,
					manf_schematic_objects.creator_name,
					manf_schematic_objects.items_per_container,
					manf_schematic_objects.manufacture_time,
					manf_schematic_objects.draft_schematic,
					manf_schematic_objects.object_id
					)
					VALUES
					(
					p_creator_id(i),
					p_creator_name(i),
					p_items_per_container(i),
					p_manufacture_time(i),
					p_draft_schematic(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into manf_schematic_objects
			(
				manf_schematic_objects.creator_id,
				manf_schematic_objects.creator_name,
				manf_schematic_objects.items_per_container,
				manf_schematic_objects.manufacture_time,
				manf_schematic_objects.draft_schematic,
				manf_schematic_objects.object_id
			)
			VALUES
			(
				p_creator_id(i),
				p_creator_name(i),
				p_items_per_container(i),
				p_manufacture_time(i),
				p_draft_schematic(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_manf_schematic_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_manf_schematic_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_manf_schematic_obj','creator_id','number',p_creator_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_manf_schematic_obj','creator_name','varchar2',p_creator_name(m_error_index));
						db_error_logger.dblogerror_values('persister.add_manf_schematic_obj','items_per_container','int',to_char(p_items_per_container(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_manf_schematic_obj','manufacture_time','float',to_char(p_manufacture_time(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_manf_schematic_obj','draft_schematic','int',to_char(p_draft_schematic(m_error_index)));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_manf_schematic_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_manf_schematic_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete manf_schematic_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_manufacture_inst_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		null;
	end;

	procedure add_manufacture_inst_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into manufacture_inst_objects
		(
			manufacture_inst_objects.object_id
		)
		VALUES
		(
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_manufacture_inst_obj : dup_val_on_index error.');
			END IF;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into manufacture_inst_objects
			(
				manufacture_inst_objects.object_id
			)
			VALUES
			(
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_manufacture_inst_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_manufacture_inst_obj','object_id','number',p_object_id(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_manufacture_inst_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_manufacture_inst_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		null;
	end;

	procedure save_mission_obj( p_object_id VAOFSTRING, p_difficulty VAOFNUMBER, p_end_x VAOFNUMBER, p_end_y VAOFNUMBER, p_end_z VAOFNUMBER, p_end_cell VAOFSTRING, p_end_scene VAOFNUMBER, p_mission_creator VAOFSTRING, p_reward VAOFNUMBER, p_root_script_name VAOFSTRING, p_start_x VAOFNUMBER, p_start_y VAOFNUMBER, p_start_z VAOFNUMBER, p_start_cell VAOFSTRING, p_start_scene VAOFNUMBER, p_description_table VAOFSTRING, p_description_text VAOFSTRING, p_title_table VAOFSTRING, p_title_text VAOFSTRING, p_mission_holder_id VAOFSTRING, p_status VAOFNUMBER, p_mission_type VAOFNUMBER, p_target_appearance VAOFNUMBER, p_target_name VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update mission_objects set
			mission_objects.difficulty = nvl(p_difficulty(i),mission_objects.difficulty),
			mission_objects.end_x = nvl(p_end_x(i),mission_objects.end_x),
			mission_objects.end_y = nvl(p_end_y(i),mission_objects.end_y),
			mission_objects.end_z = nvl(p_end_z(i),mission_objects.end_z),
			mission_objects.end_cell = nvl(p_end_cell(i),mission_objects.end_cell),
			mission_objects.end_scene = nvl(p_end_scene(i),mission_objects.end_scene),
			mission_objects.mission_creator = nvl(p_mission_creator(i),mission_objects.mission_creator),
			mission_objects.reward = nvl(p_reward(i),mission_objects.reward),
			mission_objects.root_script_name = nvl(p_root_script_name(i),mission_objects.root_script_name),
			mission_objects.start_x = nvl(p_start_x(i),mission_objects.start_x),
			mission_objects.start_y = nvl(p_start_y(i),mission_objects.start_y),
			mission_objects.start_z = nvl(p_start_z(i),mission_objects.start_z),
			mission_objects.start_cell = nvl(p_start_cell(i),mission_objects.start_cell),
			mission_objects.start_scene = nvl(p_start_scene(i),mission_objects.start_scene),
			mission_objects.description_table = nvl(p_description_table(i),mission_objects.description_table),
			mission_objects.description_text = nvl(p_description_text(i),mission_objects.description_text),
			mission_objects.title_table = nvl(p_title_table(i),mission_objects.title_table),
			mission_objects.title_text = nvl(p_title_text(i),mission_objects.title_text),
			mission_objects.mission_holder_id = nvl(p_mission_holder_id(i),mission_objects.mission_holder_id),
			mission_objects.status = nvl(p_status(i),mission_objects.status),
			mission_objects.mission_type = nvl(p_mission_type(i),mission_objects.mission_type),
			mission_objects.target_appearance = nvl(p_target_appearance(i),mission_objects.target_appearance),
			mission_objects.target_name = nvl(p_target_name(i),mission_objects.target_name)
		where
			mission_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update mission_objects set
					mission_objects.difficulty = nvl(p_difficulty(i),mission_objects.difficulty),
					mission_objects.end_x = nvl(p_end_x(i),mission_objects.end_x),
					mission_objects.end_y = nvl(p_end_y(i),mission_objects.end_y),
					mission_objects.end_z = nvl(p_end_z(i),mission_objects.end_z),
					mission_objects.end_cell = nvl(p_end_cell(i),mission_objects.end_cell),
					mission_objects.end_scene = nvl(p_end_scene(i),mission_objects.end_scene),
					mission_objects.mission_creator = nvl(p_mission_creator(i),mission_objects.mission_creator),
					mission_objects.reward = nvl(p_reward(i),mission_objects.reward),
					mission_objects.root_script_name = nvl(p_root_script_name(i),mission_objects.root_script_name),
					mission_objects.start_x = nvl(p_start_x(i),mission_objects.start_x),
					mission_objects.start_y = nvl(p_start_y(i),mission_objects.start_y),
					mission_objects.start_z = nvl(p_start_z(i),mission_objects.start_z),
					mission_objects.start_cell = nvl(p_start_cell(i),mission_objects.start_cell),
					mission_objects.start_scene = nvl(p_start_scene(i),mission_objects.start_scene),
					mission_objects.description_table = nvl(p_description_table(i),mission_objects.description_table),
					mission_objects.description_text = nvl(p_description_text(i),mission_objects.description_text),
					mission_objects.title_table = nvl(p_title_table(i),mission_objects.title_table),
					mission_objects.title_text = nvl(p_title_text(i),mission_objects.title_text),
					mission_objects.mission_holder_id = nvl(p_mission_holder_id(i),mission_objects.mission_holder_id),
					mission_objects.status = nvl(p_status(i),mission_objects.status),
					mission_objects.mission_type = nvl(p_mission_type(i),mission_objects.mission_type),
					mission_objects.target_appearance = nvl(p_target_appearance(i),mission_objects.target_appearance),
					mission_objects.target_name = nvl(p_target_name(i),mission_objects.target_name)
					where
					mission_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_mission_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_mission_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','difficulty','int',to_char(p_difficulty(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','end_x','float',to_char(p_end_x(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','end_y','float',to_char(p_end_y(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','end_z','float',to_char(p_end_z(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','end_cell','number',p_end_cell(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','end_scene','int',to_char(p_end_scene(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','mission_creator','varchar2',p_mission_creator(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','reward','int',to_char(p_reward(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','root_script_name','varchar2',p_root_script_name(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','start_x','float',to_char(p_start_x(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','start_y','float',to_char(p_start_y(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','start_z','float',to_char(p_start_z(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','start_cell','number',p_start_cell(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','start_scene','int',to_char(p_start_scene(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','description_table','varchar2',p_description_table(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','description_text','varchar2',p_description_text(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','title_table','varchar2',p_title_table(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','title_text','varchar2',p_title_text(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','mission_holder_id','number',p_mission_holder_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_mission_obj','status','int',to_char(p_status(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','mission_type','int',to_char(p_mission_type(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','target_appearance','int',to_char(p_target_appearance(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_mission_obj','target_name','varchar2',p_target_name(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_mission_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_mission_obj( p_object_id VAOFSTRING, p_difficulty VAOFNUMBER, p_end_x VAOFNUMBER, p_end_y VAOFNUMBER, p_end_z VAOFNUMBER, p_end_cell VAOFSTRING, p_end_scene VAOFNUMBER, p_mission_creator VAOFSTRING, p_reward VAOFNUMBER, p_root_script_name VAOFSTRING, p_start_x VAOFNUMBER, p_start_y VAOFNUMBER, p_start_z VAOFNUMBER, p_start_cell VAOFSTRING, p_start_scene VAOFNUMBER, p_description_table VAOFSTRING, p_description_text VAOFSTRING, p_title_table VAOFSTRING, p_title_text VAOFSTRING, p_mission_holder_id VAOFSTRING, p_status VAOFNUMBER, p_mission_type VAOFNUMBER, p_target_appearance VAOFNUMBER, p_target_name VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into mission_objects
		(
			mission_objects.difficulty,
			mission_objects.end_x,
			mission_objects.end_y,
			mission_objects.end_z,
			mission_objects.end_cell,
			mission_objects.end_scene,
			mission_objects.mission_creator,
			mission_objects.reward,
			mission_objects.root_script_name,
			mission_objects.start_x,
			mission_objects.start_y,
			mission_objects.start_z,
			mission_objects.start_cell,
			mission_objects.start_scene,
			mission_objects.description_table,
			mission_objects.description_text,
			mission_objects.title_table,
			mission_objects.title_text,
			mission_objects.mission_holder_id,
			mission_objects.status,
			mission_objects.mission_type,
			mission_objects.target_appearance,
			mission_objects.target_name,
			mission_objects.object_id
		)
		VALUES
		(
			p_difficulty(i),
			p_end_x(i),
			p_end_y(i),
			p_end_z(i),
			p_end_cell(i),
			p_end_scene(i),
			p_mission_creator(i),
			p_reward(i),
			p_root_script_name(i),
			p_start_x(i),
			p_start_y(i),
			p_start_z(i),
			p_start_cell(i),
			p_start_scene(i),
			p_description_table(i),
			p_description_text(i),
			p_title_table(i),
			p_title_text(i),
			p_mission_holder_id(i),
			p_status(i),
			p_mission_type(i),
			p_target_appearance(i),
			p_target_name(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_mission_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE mission_objects Set
					mission_objects.difficulty = nvl(p_difficulty(i),mission_objects.difficulty),
					mission_objects.end_x = nvl(p_end_x(i),mission_objects.end_x),
					mission_objects.end_y = nvl(p_end_y(i),mission_objects.end_y),
					mission_objects.end_z = nvl(p_end_z(i),mission_objects.end_z),
					mission_objects.end_cell = nvl(p_end_cell(i),mission_objects.end_cell),
					mission_objects.end_scene = nvl(p_end_scene(i),mission_objects.end_scene),
					mission_objects.mission_creator = nvl(p_mission_creator(i),mission_objects.mission_creator),
					mission_objects.reward = nvl(p_reward(i),mission_objects.reward),
					mission_objects.root_script_name = nvl(p_root_script_name(i),mission_objects.root_script_name),
					mission_objects.start_x = nvl(p_start_x(i),mission_objects.start_x),
					mission_objects.start_y = nvl(p_start_y(i),mission_objects.start_y),
					mission_objects.start_z = nvl(p_start_z(i),mission_objects.start_z),
					mission_objects.start_cell = nvl(p_start_cell(i),mission_objects.start_cell),
					mission_objects.start_scene = nvl(p_start_scene(i),mission_objects.start_scene),
					mission_objects.description_table = nvl(p_description_table(i),mission_objects.description_table),
					mission_objects.description_text = nvl(p_description_text(i),mission_objects.description_text),
					mission_objects.title_table = nvl(p_title_table(i),mission_objects.title_table),
					mission_objects.title_text = nvl(p_title_text(i),mission_objects.title_text),
					mission_objects.mission_holder_id = nvl(p_mission_holder_id(i),mission_objects.mission_holder_id),
					mission_objects.status = nvl(p_status(i),mission_objects.status),
					mission_objects.mission_type = nvl(p_mission_type(i),mission_objects.mission_type),
					mission_objects.target_appearance = nvl(p_target_appearance(i),mission_objects.target_appearance),
					mission_objects.target_name = nvl(p_target_name(i),mission_objects.target_name)
				where
					mission_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into mission_objects
					(
					mission_objects.difficulty,
					mission_objects.end_x,
					mission_objects.end_y,
					mission_objects.end_z,
					mission_objects.end_cell,
					mission_objects.end_scene,
					mission_objects.mission_creator,
					mission_objects.reward,
					mission_objects.root_script_name,
					mission_objects.start_x,
					mission_objects.start_y,
					mission_objects.start_z,
					mission_objects.start_cell,
					mission_objects.start_scene,
					mission_objects.description_table,
					mission_objects.description_text,
					mission_objects.title_table,
					mission_objects.title_text,
					mission_objects.mission_holder_id,
					mission_objects.status,
					mission_objects.mission_type,
					mission_objects.target_appearance,
					mission_objects.target_name,
					mission_objects.object_id
					)
					VALUES
					(
					p_difficulty(i),
					p_end_x(i),
					p_end_y(i),
					p_end_z(i),
					p_end_cell(i),
					p_end_scene(i),
					p_mission_creator(i),
					p_reward(i),
					p_root_script_name(i),
					p_start_x(i),
					p_start_y(i),
					p_start_z(i),
					p_start_cell(i),
					p_start_scene(i),
					p_description_table(i),
					p_description_text(i),
					p_title_table(i),
					p_title_text(i),
					p_mission_holder_id(i),
					p_status(i),
					p_mission_type(i),
					p_target_appearance(i),
					p_target_name(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into mission_objects
			(
				mission_objects.difficulty,
				mission_objects.end_x,
				mission_objects.end_y,
				mission_objects.end_z,
				mission_objects.end_cell,
				mission_objects.end_scene,
				mission_objects.mission_creator,
				mission_objects.reward,
				mission_objects.root_script_name,
				mission_objects.start_x,
				mission_objects.start_y,
				mission_objects.start_z,
				mission_objects.start_cell,
				mission_objects.start_scene,
				mission_objects.description_table,
				mission_objects.description_text,
				mission_objects.title_table,
				mission_objects.title_text,
				mission_objects.mission_holder_id,
				mission_objects.status,
				mission_objects.mission_type,
				mission_objects.target_appearance,
				mission_objects.target_name,
				mission_objects.object_id
			)
			VALUES
			(
				p_difficulty(i),
				p_end_x(i),
				p_end_y(i),
				p_end_z(i),
				p_end_cell(i),
				p_end_scene(i),
				p_mission_creator(i),
				p_reward(i),
				p_root_script_name(i),
				p_start_x(i),
				p_start_y(i),
				p_start_z(i),
				p_start_cell(i),
				p_start_scene(i),
				p_description_table(i),
				p_description_text(i),
				p_title_table(i),
				p_title_text(i),
				p_mission_holder_id(i),
				p_status(i),
				p_mission_type(i),
				p_target_appearance(i),
				p_target_name(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_mission_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_mission_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','difficulty','int',to_char(p_difficulty(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','end_x','float',to_char(p_end_x(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','end_y','float',to_char(p_end_y(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','end_z','float',to_char(p_end_z(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','end_cell','number',p_end_cell(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','end_scene','int',to_char(p_end_scene(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','mission_creator','varchar2',p_mission_creator(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','reward','int',to_char(p_reward(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','root_script_name','varchar2',p_root_script_name(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','start_x','float',to_char(p_start_x(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','start_y','float',to_char(p_start_y(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','start_z','float',to_char(p_start_z(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','start_cell','number',p_start_cell(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','start_scene','int',to_char(p_start_scene(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','description_table','varchar2',p_description_table(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','description_text','varchar2',p_description_text(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','title_table','varchar2',p_title_table(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','title_text','varchar2',p_title_text(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','mission_holder_id','number',p_mission_holder_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_mission_obj','status','int',to_char(p_status(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','mission_type','int',to_char(p_mission_type(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','target_appearance','int',to_char(p_target_appearance(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_mission_obj','target_name','varchar2',p_target_name(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_mission_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_mission_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete mission_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_planet_obj( p_object_id VAOFSTRING, p_planet_name VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update planet_objects set
			planet_objects.planet_name = nvl(p_planet_name(i),planet_objects.planet_name)
		where
			planet_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update planet_objects set
					planet_objects.planet_name = nvl(p_planet_name(i),planet_objects.planet_name)
					where
					planet_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_planet_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_planet_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_planet_obj','planet_name','varchar',p_planet_name(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_planet_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_planet_obj( p_object_id VAOFSTRING, p_planet_name VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into planet_objects
		(
			planet_objects.planet_name,
			planet_objects.object_id
		)
		VALUES
		(
			p_planet_name(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_planet_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE planet_objects Set
					planet_objects.planet_name = nvl(p_planet_name(i),planet_objects.planet_name)
				where
					planet_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into planet_objects
					(
					planet_objects.planet_name,
					planet_objects.object_id
					)
					VALUES
					(
					p_planet_name(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into planet_objects
			(
				planet_objects.planet_name,
				planet_objects.object_id
			)
			VALUES
			(
				p_planet_name(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_planet_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_planet_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_planet_obj','planet_name','varchar',p_planet_name(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_planet_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_planet_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete planet_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_resource_container_obj( p_object_id VAOFSTRING, p_resource_type VAOFSTRING, p_quantity VAOFNUMBER, p_source VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update resource_container_objects set
			resource_container_objects.resource_type = nvl(p_resource_type(i),resource_container_objects.resource_type),
			resource_container_objects.quantity = nvl(p_quantity(i),resource_container_objects.quantity),
			resource_container_objects.source = nvl(p_source(i),resource_container_objects.source)
		where
			resource_container_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update resource_container_objects set
					resource_container_objects.resource_type = nvl(p_resource_type(i),resource_container_objects.resource_type),
					resource_container_objects.quantity = nvl(p_quantity(i),resource_container_objects.quantity),
					resource_container_objects.source = nvl(p_source(i),resource_container_objects.source)
					where
					resource_container_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_resource_container_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_resource_container_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_resource_container_obj','resource_type','number',p_resource_type(m_error_index));
								db_error_logger.dblogerror_values('persister.save_resource_container_obj','quantity','int',to_char(p_quantity(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_resource_container_obj','source','number',p_source(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_resource_container_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_resource_container_obj( p_object_id VAOFSTRING, p_resource_type VAOFSTRING, p_quantity VAOFNUMBER, p_source VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into resource_container_objects
		(
			resource_container_objects.resource_type,
			resource_container_objects.quantity,
			resource_container_objects.source,
			resource_container_objects.object_id
		)
		VALUES
		(
			p_resource_type(i),
			p_quantity(i),
			p_source(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_resource_container_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE resource_container_objects Set
					resource_container_objects.resource_type = nvl(p_resource_type(i),resource_container_objects.resource_type),
					resource_container_objects.quantity = nvl(p_quantity(i),resource_container_objects.quantity),
					resource_container_objects.source = nvl(p_source(i),resource_container_objects.source)
				where
					resource_container_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into resource_container_objects
					(
					resource_container_objects.resource_type,
					resource_container_objects.quantity,
					resource_container_objects.source,
					resource_container_objects.object_id
					)
					VALUES
					(
					p_resource_type(i),
					p_quantity(i),
					p_source(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into resource_container_objects
			(
				resource_container_objects.resource_type,
				resource_container_objects.quantity,
				resource_container_objects.source,
				resource_container_objects.object_id
			)
			VALUES
			(
				p_resource_type(i),
				p_quantity(i),
				p_source(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_resource_container_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_resource_container_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_resource_container_obj','resource_type','number',p_resource_type(m_error_index));
						db_error_logger.dblogerror_values('persister.add_resource_container_obj','quantity','int',to_char(p_quantity(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_resource_container_obj','source','number',p_source(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_resource_container_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_resource_container_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete resource_container_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_ship_obj(p_object_id VAOFSTRING, p_slide_dampener VAOFNUMBER, p_current_chassis_hit_points VAOFNUMBER, p_maximum_chassis_hit_points VAOFNUMBER, p_chassis_type VAOFNUMBER, p_cmp_armor_hp_maximum VAOFSTRING, p_cmp_armor_hp_current VAOFSTRING, p_cmp_efficiency_general VAOFSTRING, p_cmp_efficiency_eng VAOFSTRING, p_cmp_eng_maintenance VAOFSTRING, p_cmp_mass VAOFSTRING, p_cmp_crc VAOFSTRING, p_cmp_hp_current VAOFSTRING, p_cmp_hp_maximum VAOFSTRING, p_cmp_flags VAOFSTRING, p_cmp_names VAOFLONGSTRING, p_weapon_damage_maximum VAOFSTRING, p_weapon_damage_minimum VAOFSTRING, p_weapon_effectiveness_shields VAOFSTRING, p_weapon_effectiveness_armor VAOFSTRING, p_weapon_eng_per_shot VAOFSTRING, p_weapon_refire_rate VAOFSTRING, p_weapon_ammo_current VAOFSTRING, p_weapon_ammo_maximum VAOFSTRING, p_weapon_ammo_type VAOFSTRING, p_shield_hp_front_maximum VAOFNUMBER, p_shield_hp_back_maximum VAOFNUMBER, p_shield_recharge_rate VAOFNUMBER, p_capacitor_eng_maximum VAOFNUMBER, p_capacitor_eng_recharge_rate VAOFNUMBER, p_engine_acc_rate VAOFNUMBER, p_engine_deceleration_rate VAOFNUMBER, p_engine_pitch_acc_rate VAOFNUMBER, p_engine_yaw_acc_rate VAOFNUMBER, p_engine_roll_acc_rate VAOFNUMBER, p_engine_pitch_rate_maximum VAOFNUMBER, p_engine_yaw_rate_maximum VAOFNUMBER, p_engine_roll_rate_maximum VAOFNUMBER, p_engine_speed_maximum VAOFNUMBER, p_reactor_eng_generation_rate VAOFNUMBER, p_booster_eng_maximum VAOFNUMBER, p_booster_eng_recharge_rate VAOFNUMBER, p_booster_eng_consumption_rate VAOFNUMBER, p_booster_acc VAOFNUMBER, p_booster_speed_maximum VAOFNUMBER, p_droid_if_cmd_speed VAOFNUMBER, p_installed_dcd VAOFSTRING, p_chassis_cmp_mass_maximum VAOFNUMBER, p_cmp_creators VAOFSTRING, p_cargo_hold_contents_maximum VAOFNUMBER, p_cargo_hold_contents_current VAOFNUMBER, p_cargo_hold_contents VAOFSTRING, p_chunk_size number)
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update ship_objects set
			ship_objects.slide_dampener = nvl(p_slide_dampener(i),ship_objects.slide_dampener),
			ship_objects.current_chassis_hit_points = nvl(p_current_chassis_hit_points(i),ship_objects.current_chassis_hit_points),
			ship_objects.maximum_chassis_hit_points = nvl(p_maximum_chassis_hit_points(i),ship_objects.maximum_chassis_hit_points),
			ship_objects.chassis_type = nvl(p_chassis_type(i),ship_objects.chassis_type),
			ship_objects.cmp_armor_hp_maximum = nvl(p_cmp_armor_hp_maximum(i),ship_objects.cmp_armor_hp_maximum),
			ship_objects.cmp_armor_hp_current = nvl(p_cmp_armor_hp_current(i),ship_objects.cmp_armor_hp_current),
			ship_objects.cmp_efficiency_general = nvl(p_cmp_efficiency_general(i),ship_objects.cmp_efficiency_general),
			ship_objects.cmp_efficiency_eng = nvl(p_cmp_efficiency_eng(i),ship_objects.cmp_efficiency_eng),
			ship_objects.cmp_eng_maintenance = nvl(p_cmp_eng_maintenance(i),ship_objects.cmp_eng_maintenance),
			ship_objects.cmp_mass = nvl(p_cmp_mass(i),ship_objects.cmp_mass),
			ship_objects.cmp_crc = nvl(p_cmp_crc(i),ship_objects.cmp_crc),
			ship_objects.cmp_hp_current = nvl(p_cmp_hp_current(i),ship_objects.cmp_hp_current),
			ship_objects.cmp_hp_maximum = nvl(p_cmp_hp_maximum(i),ship_objects.cmp_hp_maximum),
			ship_objects.cmp_flags = nvl(p_cmp_flags(i),ship_objects.cmp_flags),
			ship_objects.cmp_names = nvl(p_cmp_names(i),ship_objects.cmp_names),
			ship_objects.weapon_damage_maximum = nvl(p_weapon_damage_maximum(i),ship_objects.weapon_damage_maximum),
			ship_objects.weapon_damage_minimum = nvl(p_weapon_damage_minimum(i),ship_objects.weapon_damage_minimum),
			ship_objects.weapon_effectiveness_shields = nvl(p_weapon_effectiveness_shields(i),ship_objects.weapon_effectiveness_shields),
			ship_objects.weapon_effectiveness_armor = nvl(p_weapon_effectiveness_armor(i),ship_objects.weapon_effectiveness_armor),
			ship_objects.weapon_eng_per_shot = nvl(p_weapon_eng_per_shot(i),ship_objects.weapon_eng_per_shot),
			ship_objects.weapon_refire_rate = nvl(p_weapon_refire_rate(i),ship_objects.weapon_refire_rate),
			ship_objects.weapon_ammo_current = nvl(p_weapon_ammo_current(i),ship_objects.weapon_ammo_current),
			ship_objects.weapon_ammo_maximum = nvl(p_weapon_ammo_maximum(i),ship_objects.weapon_ammo_maximum),
			ship_objects.weapon_ammo_type = nvl(p_weapon_ammo_type(i),ship_objects.weapon_ammo_type),
			ship_objects.shield_hp_front_maximum = nvl(p_shield_hp_front_maximum(i),ship_objects.shield_hp_front_maximum),
			ship_objects.shield_hp_back_maximum = nvl(p_shield_hp_back_maximum(i),ship_objects.shield_hp_back_maximum),
			ship_objects.shield_recharge_rate = nvl(p_shield_recharge_rate(i),ship_objects.shield_recharge_rate),
			ship_objects.capacitor_eng_maximum = nvl(p_capacitor_eng_maximum(i),ship_objects.capacitor_eng_maximum),
			ship_objects.capacitor_eng_recharge_rate = nvl(p_capacitor_eng_recharge_rate(i),ship_objects.capacitor_eng_recharge_rate),
			ship_objects.engine_acc_rate = nvl(p_engine_acc_rate(i),ship_objects.engine_acc_rate),
			ship_objects.engine_deceleration_rate = nvl(p_engine_deceleration_rate(i),ship_objects.engine_deceleration_rate),
			ship_objects.engine_pitch_acc_rate = nvl(p_engine_pitch_acc_rate(i),ship_objects.engine_pitch_acc_rate),
			ship_objects.engine_yaw_acc_rate = nvl(p_engine_yaw_acc_rate(i),ship_objects.engine_yaw_acc_rate),
			ship_objects.engine_roll_acc_rate = nvl(p_engine_roll_acc_rate(i),ship_objects.engine_roll_acc_rate),
			ship_objects.engine_pitch_rate_maximum = nvl(p_engine_pitch_rate_maximum(i),ship_objects.engine_pitch_rate_maximum),
			ship_objects.engine_yaw_rate_maximum = nvl(p_engine_yaw_rate_maximum(i),ship_objects.engine_yaw_rate_maximum),
			ship_objects.engine_roll_rate_maximum = nvl(p_engine_roll_rate_maximum(i),ship_objects.engine_roll_rate_maximum),
			ship_objects.engine_speed_maximum = nvl(p_engine_speed_maximum(i),ship_objects.engine_speed_maximum),
			ship_objects.reactor_eng_generation_rate = nvl(p_reactor_eng_generation_rate(i),ship_objects.reactor_eng_generation_rate),
			ship_objects.booster_eng_maximum = nvl(p_booster_eng_maximum(i),ship_objects.booster_eng_maximum),
			ship_objects.booster_eng_recharge_rate = nvl(p_booster_eng_recharge_rate(i),ship_objects.booster_eng_recharge_rate),
			ship_objects.booster_eng_consumption_rate = nvl(p_booster_eng_consumption_rate(i),ship_objects.booster_eng_consumption_rate),
			ship_objects.booster_acc = nvl(p_booster_acc(i),ship_objects.booster_acc),
			ship_objects.booster_speed_maximum = nvl(p_booster_speed_maximum(i),ship_objects.booster_speed_maximum),
			ship_objects.droid_if_cmd_speed = nvl(p_droid_if_cmd_speed(i),ship_objects.droid_if_cmd_speed),
			ship_objects.installed_dcd = nvl(p_installed_dcd(i),ship_objects.installed_dcd),
			ship_objects.chassis_cmp_mass_maximum = nvl(p_chassis_cmp_mass_maximum(i),ship_objects.chassis_cmp_mass_maximum),
			ship_objects.cmp_creators = nvl(p_cmp_creators(i),ship_objects.cmp_creators),
			ship_objects.cargo_hold_contents_maximum = nvl(p_cargo_hold_contents_maximum(i),ship_objects.cargo_hold_contents_maximum),
			ship_objects.cargo_hold_contents_current = nvl(p_cargo_hold_contents_current(i),ship_objects.cargo_hold_contents_current),
			ship_objects.cargo_hold_contents = nvl(p_cargo_hold_contents(i),ship_objects.cargo_hold_contents)
		where
			ship_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update ship_objects set
					ship_objects.slide_dampener = nvl(p_slide_dampener(i),ship_objects.slide_dampener),
					ship_objects.current_chassis_hit_points = nvl(p_current_chassis_hit_points(i),ship_objects.current_chassis_hit_points),
					ship_objects.maximum_chassis_hit_points = nvl(p_maximum_chassis_hit_points(i),ship_objects.maximum_chassis_hit_points),
					ship_objects.chassis_type = nvl(p_chassis_type(i),ship_objects.chassis_type),
					ship_objects.cmp_armor_hp_maximum = nvl(p_cmp_armor_hp_maximum(i),ship_objects.cmp_armor_hp_maximum),
					ship_objects.cmp_armor_hp_current = nvl(p_cmp_armor_hp_current(i),ship_objects.cmp_armor_hp_current),
					ship_objects.cmp_efficiency_general = nvl(p_cmp_efficiency_general(i),ship_objects.cmp_efficiency_general),
					ship_objects.cmp_efficiency_eng = nvl(p_cmp_efficiency_eng(i),ship_objects.cmp_efficiency_eng),
					ship_objects.cmp_eng_maintenance = nvl(p_cmp_eng_maintenance(i),ship_objects.cmp_eng_maintenance),
					ship_objects.cmp_mass = nvl(p_cmp_mass(i),ship_objects.cmp_mass),
					ship_objects.cmp_crc = nvl(p_cmp_crc(i),ship_objects.cmp_crc),
					ship_objects.cmp_hp_current = nvl(p_cmp_hp_current(i),ship_objects.cmp_hp_current),
					ship_objects.cmp_hp_maximum = nvl(p_cmp_hp_maximum(i),ship_objects.cmp_hp_maximum),
					ship_objects.cmp_flags = nvl(p_cmp_flags(i),ship_objects.cmp_flags),
					ship_objects.cmp_names = nvl(p_cmp_names(i),ship_objects.cmp_names),
					ship_objects.weapon_damage_maximum = nvl(p_weapon_damage_maximum(i),ship_objects.weapon_damage_maximum),
					ship_objects.weapon_damage_minimum = nvl(p_weapon_damage_minimum(i),ship_objects.weapon_damage_minimum),
					ship_objects.weapon_effectiveness_shields = nvl(p_weapon_effectiveness_shields(i),ship_objects.weapon_effectiveness_shields),
					ship_objects.weapon_effectiveness_armor = nvl(p_weapon_effectiveness_armor(i),ship_objects.weapon_effectiveness_armor),
					ship_objects.weapon_eng_per_shot = nvl(p_weapon_eng_per_shot(i),ship_objects.weapon_eng_per_shot),
					ship_objects.weapon_refire_rate = nvl(p_weapon_refire_rate(i),ship_objects.weapon_refire_rate),
					ship_objects.weapon_ammo_current = nvl(p_weapon_ammo_current(i),ship_objects.weapon_ammo_current),
					ship_objects.weapon_ammo_maximum = nvl(p_weapon_ammo_maximum(i),ship_objects.weapon_ammo_maximum),
					ship_objects.weapon_ammo_type = nvl(p_weapon_ammo_type(i),ship_objects.weapon_ammo_type),
					ship_objects.shield_hp_front_maximum = nvl(p_shield_hp_front_maximum(i),ship_objects.shield_hp_front_maximum),
					ship_objects.shield_hp_back_maximum = nvl(p_shield_hp_back_maximum(i),ship_objects.shield_hp_back_maximum),
					ship_objects.shield_recharge_rate = nvl(p_shield_recharge_rate(i),ship_objects.shield_recharge_rate),
					ship_objects.capacitor_eng_maximum = nvl(p_capacitor_eng_maximum(i),ship_objects.capacitor_eng_maximum),
					ship_objects.capacitor_eng_recharge_rate = nvl(p_capacitor_eng_recharge_rate(i),ship_objects.capacitor_eng_recharge_rate),
					ship_objects.engine_acc_rate = nvl(p_engine_acc_rate(i),ship_objects.engine_acc_rate),
					ship_objects.engine_deceleration_rate = nvl(p_engine_deceleration_rate(i),ship_objects.engine_deceleration_rate),
					ship_objects.engine_pitch_acc_rate = nvl(p_engine_pitch_acc_rate(i),ship_objects.engine_pitch_acc_rate),
					ship_objects.engine_yaw_acc_rate = nvl(p_engine_yaw_acc_rate(i),ship_objects.engine_yaw_acc_rate),
					ship_objects.engine_roll_acc_rate = nvl(p_engine_roll_acc_rate(i),ship_objects.engine_roll_acc_rate),
					ship_objects.engine_pitch_rate_maximum = nvl(p_engine_pitch_rate_maximum(i),ship_objects.engine_pitch_rate_maximum),
					ship_objects.engine_yaw_rate_maximum = nvl(p_engine_yaw_rate_maximum(i),ship_objects.engine_yaw_rate_maximum),
					ship_objects.engine_roll_rate_maximum = nvl(p_engine_roll_rate_maximum(i),ship_objects.engine_roll_rate_maximum),
					ship_objects.engine_speed_maximum = nvl(p_engine_speed_maximum(i),ship_objects.engine_speed_maximum),
					ship_objects.reactor_eng_generation_rate = nvl(p_reactor_eng_generation_rate(i),ship_objects.reactor_eng_generation_rate),
					ship_objects.booster_eng_maximum = nvl(p_booster_eng_maximum(i),ship_objects.booster_eng_maximum),
					ship_objects.booster_eng_recharge_rate = nvl(p_booster_eng_recharge_rate(i),ship_objects.booster_eng_recharge_rate),
					ship_objects.booster_eng_consumption_rate = nvl(p_booster_eng_consumption_rate(i),ship_objects.booster_eng_consumption_rate),
					ship_objects.booster_acc = nvl(p_booster_acc(i),ship_objects.booster_acc),
					ship_objects.booster_speed_maximum = nvl(p_booster_speed_maximum(i),ship_objects.booster_speed_maximum),
					ship_objects.droid_if_cmd_speed = nvl(p_droid_if_cmd_speed(i),ship_objects.droid_if_cmd_speed),
					ship_objects.installed_dcd = nvl(p_installed_dcd(i),ship_objects.installed_dcd),
					ship_objects.chassis_cmp_mass_maximum = nvl(p_chassis_cmp_mass_maximum(i),ship_objects.chassis_cmp_mass_maximum),
					ship_objects.cmp_creators = nvl(p_cmp_creators(i),ship_objects.cmp_creators),
					ship_objects.cargo_hold_contents_maximum = nvl(p_cargo_hold_contents_maximum(i),ship_objects.cargo_hold_contents_maximum),
					ship_objects.cargo_hold_contents_current = nvl(p_cargo_hold_contents_current(i),ship_objects.cargo_hold_contents_current),
					ship_objects.cargo_hold_contents = nvl(p_cargo_hold_contents(i),ship_objects.cargo_hold_contents)
					where
					ship_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_ship_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_ship_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','slide_dampener','float',to_char(p_slide_dampener(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','current_chassis_hit_points','float',to_char(p_current_chassis_hit_points(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','maximum_chassis_hit_points','float',to_char(p_maximum_chassis_hit_points(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','chassis_type','int',to_char(p_chassis_type(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_armor_hp_maximum','varchar2',p_cmp_armor_hp_maximum(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_armor_hp_current','varchar2',p_cmp_armor_hp_current(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_efficiency_general','varchar2',p_cmp_efficiency_general(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_efficiency_eng','varchar2',p_cmp_efficiency_eng(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_eng_maintenance','varchar2',p_cmp_eng_maintenance(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_mass','varchar2',p_cmp_mass(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_crc','varchar2',p_cmp_crc(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_hp_current','varchar2',p_cmp_hp_current(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_hp_maximum','varchar2',p_cmp_hp_maximum(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_flags','varchar2',p_cmp_flags(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_names','varchar2',p_cmp_names(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_damage_maximum','varchar2',p_weapon_damage_maximum(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_damage_minimum','varchar2',p_weapon_damage_minimum(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_effectiveness_shields','varchar2',p_weapon_effectiveness_shields(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_effectiveness_armor','varchar2',p_weapon_effectiveness_armor(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_eng_per_shot','varchar2',p_weapon_eng_per_shot(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_refire_rate','varchar2',p_weapon_refire_rate(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_ammo_current','varchar2',p_weapon_ammo_current(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_ammo_maximum','varchar2',p_weapon_ammo_maximum(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','weapon_ammo_type','varchar2',p_weapon_ammo_type(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','shield_hp_front_maximum','float',to_char(p_shield_hp_front_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','shield_hp_back_maximum','float',to_char(p_shield_hp_back_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','shield_recharge_rate','float',to_char(p_shield_recharge_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','capacitor_eng_maximum','float',to_char(p_capacitor_eng_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','capacitor_eng_recharge_rate','float',to_char(p_capacitor_eng_recharge_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_acc_rate','float',to_char(p_engine_acc_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_deceleration_rate','float',to_char(p_engine_deceleration_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_pitch_acc_rate','float',to_char(p_engine_pitch_acc_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_yaw_acc_rate','float',to_char(p_engine_yaw_acc_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_roll_acc_rate','float',to_char(p_engine_roll_acc_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_pitch_rate_maximum','float',to_char(p_engine_pitch_rate_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_yaw_rate_maximum','float',to_char(p_engine_yaw_rate_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_roll_rate_maximum','float',to_char(p_engine_roll_rate_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','engine_speed_maximum','float',to_char(p_engine_speed_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','reactor_eng_generation_rate','float',to_char(p_reactor_eng_generation_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','booster_eng_maximum','float',to_char(p_booster_eng_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','booster_eng_recharge_rate','float',to_char(p_booster_eng_recharge_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','booster_eng_consumption_rate','float',to_char(p_booster_eng_consumption_rate(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','booster_acc','float',to_char(p_booster_acc(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','booster_speed_maximum','float',to_char(p_booster_speed_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','droid_if_cmd_speed','float',to_char(p_droid_if_cmd_speed(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','installed_dcd','number',p_installed_dcd(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','chassis_cmp_mass_maximum','float',to_char(p_chassis_cmp_mass_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cmp_creators','varchar2',p_cmp_creators(m_error_index));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cargo_hold_contents_maximum','number',to_char(p_cargo_hold_contents_maximum(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cargo_hold_contents_current','number',to_char(p_cargo_hold_contents_current(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_ship_obj','cargo_hold_contents','varchar2',p_cargo_hold_contents(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_ship_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_ship_obj(p_object_id VAOFSTRING, p_slide_dampener VAOFNUMBER, p_current_chassis_hit_points VAOFNUMBER, p_maximum_chassis_hit_points VAOFNUMBER, p_chassis_type VAOFNUMBER, p_cmp_armor_hp_maximum VAOFSTRING, p_cmp_armor_hp_current VAOFSTRING, p_cmp_efficiency_general VAOFSTRING, p_cmp_efficiency_eng VAOFSTRING, p_cmp_eng_maintenance VAOFSTRING, p_cmp_mass VAOFSTRING, p_cmp_crc VAOFSTRING, p_cmp_hp_current VAOFSTRING, p_cmp_hp_maximum VAOFSTRING, p_cmp_flags VAOFSTRING, p_cmp_names VAOFLONGSTRING, p_weapon_damage_maximum VAOFSTRING, p_weapon_damage_minimum VAOFSTRING, p_weapon_effectiveness_shields VAOFSTRING, p_weapon_effectiveness_armor VAOFSTRING, p_weapon_eng_per_shot VAOFSTRING, p_weapon_refire_rate VAOFSTRING, p_weapon_ammo_current VAOFSTRING, p_weapon_ammo_maximum VAOFSTRING, p_weapon_ammo_type VAOFSTRING, p_shield_hp_front_maximum VAOFNUMBER, p_shield_hp_back_maximum VAOFNUMBER, p_shield_recharge_rate VAOFNUMBER, p_capacitor_eng_maximum VAOFNUMBER, p_capacitor_eng_recharge_rate VAOFNUMBER, p_engine_acc_rate VAOFNUMBER, p_engine_deceleration_rate VAOFNUMBER, p_engine_pitch_acc_rate VAOFNUMBER, p_engine_yaw_acc_rate VAOFNUMBER, p_engine_roll_acc_rate VAOFNUMBER, p_engine_pitch_rate_maximum VAOFNUMBER, p_engine_yaw_rate_maximum VAOFNUMBER, p_engine_roll_rate_maximum VAOFNUMBER, p_engine_speed_maximum VAOFNUMBER, p_reactor_eng_generation_rate VAOFNUMBER, p_booster_eng_maximum VAOFNUMBER, p_booster_eng_recharge_rate VAOFNUMBER, p_booster_eng_consumption_rate VAOFNUMBER, p_booster_acc VAOFNUMBER, p_booster_speed_maximum VAOFNUMBER, p_droid_if_cmd_speed VAOFNUMBER, p_installed_dcd VAOFSTRING, p_chassis_cmp_mass_maximum VAOFNUMBER, p_cmp_creators VAOFSTRING, p_cargo_hold_contents_maximum VAOFNUMBER, p_cargo_hold_contents_current VAOFNUMBER, p_cargo_hold_contents VAOFSTRING, p_chunk_size number)
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into ship_objects
		(
			ship_objects.slide_dampener,
			ship_objects.current_chassis_hit_points,
			ship_objects.maximum_chassis_hit_points,
			ship_objects.chassis_type,
			ship_objects.cmp_armor_hp_maximum,
			ship_objects.cmp_armor_hp_current,
			ship_objects.cmp_efficiency_general,
			ship_objects.cmp_efficiency_eng,
			ship_objects.cmp_eng_maintenance,
			ship_objects.cmp_mass,
			ship_objects.cmp_crc,
			ship_objects.cmp_hp_current,
			ship_objects.cmp_hp_maximum,
			ship_objects.cmp_flags,
			ship_objects.cmp_names,
			ship_objects.weapon_damage_maximum,
			ship_objects.weapon_damage_minimum,
			ship_objects.weapon_effectiveness_shields,
			ship_objects.weapon_effectiveness_armor,
			ship_objects.weapon_eng_per_shot,
			ship_objects.weapon_refire_rate,
			ship_objects.weapon_ammo_current,
			ship_objects.weapon_ammo_maximum,
			ship_objects.weapon_ammo_type,
			ship_objects.shield_hp_front_maximum,
			ship_objects.shield_hp_back_maximum,
			ship_objects.shield_recharge_rate,
			ship_objects.capacitor_eng_maximum,
			ship_objects.capacitor_eng_recharge_rate,
			ship_objects.engine_acc_rate,
			ship_objects.engine_deceleration_rate,
			ship_objects.engine_pitch_acc_rate,
			ship_objects.engine_yaw_acc_rate,
			ship_objects.engine_roll_acc_rate,
			ship_objects.engine_pitch_rate_maximum,
			ship_objects.engine_yaw_rate_maximum,
			ship_objects.engine_roll_rate_maximum,
			ship_objects.engine_speed_maximum,
			ship_objects.reactor_eng_generation_rate,
			ship_objects.booster_eng_maximum,
			ship_objects.booster_eng_recharge_rate,
			ship_objects.booster_eng_consumption_rate,
			ship_objects.booster_acc,
			ship_objects.booster_speed_maximum,
			ship_objects.droid_if_cmd_speed,
			ship_objects.installed_dcd,
			ship_objects.chassis_cmp_mass_maximum,
			ship_objects.cmp_creators,
			ship_objects.cargo_hold_contents_maximum,
			ship_objects.cargo_hold_contents_current,
			ship_objects.cargo_hold_contents,
			ship_objects.object_id
		)
		VALUES
		(
			p_slide_dampener(i),
			p_current_chassis_hit_points(i),
			p_maximum_chassis_hit_points(i),
			p_chassis_type(i),
			p_cmp_armor_hp_maximum(i),
			p_cmp_armor_hp_current(i),
			p_cmp_efficiency_general(i),
			p_cmp_efficiency_eng(i),
			p_cmp_eng_maintenance(i),
			p_cmp_mass(i),
			p_cmp_crc(i),
			p_cmp_hp_current(i),
			p_cmp_hp_maximum(i),
			p_cmp_flags(i),
			p_cmp_names(i),
			p_weapon_damage_maximum(i),
			p_weapon_damage_minimum(i),
			p_weapon_effectiveness_shields(i),
			p_weapon_effectiveness_armor(i),
			p_weapon_eng_per_shot(i),
			p_weapon_refire_rate(i),
			p_weapon_ammo_current(i),
			p_weapon_ammo_maximum(i),
			p_weapon_ammo_type(i),
			p_shield_hp_front_maximum(i),
			p_shield_hp_back_maximum(i),
			p_shield_recharge_rate(i),
			p_capacitor_eng_maximum(i),
			p_capacitor_eng_recharge_rate(i),
			p_engine_acc_rate(i),
			p_engine_deceleration_rate(i),
			p_engine_pitch_acc_rate(i),
			p_engine_yaw_acc_rate(i),
			p_engine_roll_acc_rate(i),
			p_engine_pitch_rate_maximum(i),
			p_engine_yaw_rate_maximum(i),
			p_engine_roll_rate_maximum(i),
			p_engine_speed_maximum(i),
			p_reactor_eng_generation_rate(i),
			p_booster_eng_maximum(i),
			p_booster_eng_recharge_rate(i),
			p_booster_eng_consumption_rate(i),
			p_booster_acc(i),
			p_booster_speed_maximum(i),
			p_droid_if_cmd_speed(i),
			p_installed_dcd(i),
			p_chassis_cmp_mass_maximum(i),
			p_cmp_creators(i),
			p_cargo_hold_contents_maximum(i),
			p_cargo_hold_contents_current(i),
			p_cargo_hold_contents(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_ship_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE ship_objects Set
					ship_objects.slide_dampener = nvl(p_slide_dampener(i),ship_objects.slide_dampener),
					ship_objects.current_chassis_hit_points = nvl(p_current_chassis_hit_points(i),ship_objects.current_chassis_hit_points),
					ship_objects.maximum_chassis_hit_points = nvl(p_maximum_chassis_hit_points(i),ship_objects.maximum_chassis_hit_points),
					ship_objects.chassis_type = nvl(p_chassis_type(i),ship_objects.chassis_type),
					ship_objects.cmp_armor_hp_maximum = nvl(p_cmp_armor_hp_maximum(i),ship_objects.cmp_armor_hp_maximum),
					ship_objects.cmp_armor_hp_current = nvl(p_cmp_armor_hp_current(i),ship_objects.cmp_armor_hp_current),
					ship_objects.cmp_efficiency_general = nvl(p_cmp_efficiency_general(i),ship_objects.cmp_efficiency_general),
					ship_objects.cmp_efficiency_eng = nvl(p_cmp_efficiency_eng(i),ship_objects.cmp_efficiency_eng),
					ship_objects.cmp_eng_maintenance = nvl(p_cmp_eng_maintenance(i),ship_objects.cmp_eng_maintenance),
					ship_objects.cmp_mass = nvl(p_cmp_mass(i),ship_objects.cmp_mass),
					ship_objects.cmp_crc = nvl(p_cmp_crc(i),ship_objects.cmp_crc),
					ship_objects.cmp_hp_current = nvl(p_cmp_hp_current(i),ship_objects.cmp_hp_current),
					ship_objects.cmp_hp_maximum = nvl(p_cmp_hp_maximum(i),ship_objects.cmp_hp_maximum),
					ship_objects.cmp_flags = nvl(p_cmp_flags(i),ship_objects.cmp_flags),
					ship_objects.cmp_names = nvl(p_cmp_names(i),ship_objects.cmp_names),
					ship_objects.weapon_damage_maximum = nvl(p_weapon_damage_maximum(i),ship_objects.weapon_damage_maximum),
					ship_objects.weapon_damage_minimum = nvl(p_weapon_damage_minimum(i),ship_objects.weapon_damage_minimum),
					ship_objects.weapon_effectiveness_shields = nvl(p_weapon_effectiveness_shields(i),ship_objects.weapon_effectiveness_shields),
					ship_objects.weapon_effectiveness_armor = nvl(p_weapon_effectiveness_armor(i),ship_objects.weapon_effectiveness_armor),
					ship_objects.weapon_eng_per_shot = nvl(p_weapon_eng_per_shot(i),ship_objects.weapon_eng_per_shot),
					ship_objects.weapon_refire_rate = nvl(p_weapon_refire_rate(i),ship_objects.weapon_refire_rate),
					ship_objects.weapon_ammo_current = nvl(p_weapon_ammo_current(i),ship_objects.weapon_ammo_current),
					ship_objects.weapon_ammo_maximum = nvl(p_weapon_ammo_maximum(i),ship_objects.weapon_ammo_maximum),
					ship_objects.weapon_ammo_type = nvl(p_weapon_ammo_type(i),ship_objects.weapon_ammo_type),
					ship_objects.shield_hp_front_maximum = nvl(p_shield_hp_front_maximum(i),ship_objects.shield_hp_front_maximum),
					ship_objects.shield_hp_back_maximum = nvl(p_shield_hp_back_maximum(i),ship_objects.shield_hp_back_maximum),
					ship_objects.shield_recharge_rate = nvl(p_shield_recharge_rate(i),ship_objects.shield_recharge_rate),
					ship_objects.capacitor_eng_maximum = nvl(p_capacitor_eng_maximum(i),ship_objects.capacitor_eng_maximum),
					ship_objects.capacitor_eng_recharge_rate = nvl(p_capacitor_eng_recharge_rate(i),ship_objects.capacitor_eng_recharge_rate),
					ship_objects.engine_acc_rate = nvl(p_engine_acc_rate(i),ship_objects.engine_acc_rate),
					ship_objects.engine_deceleration_rate = nvl(p_engine_deceleration_rate(i),ship_objects.engine_deceleration_rate),
					ship_objects.engine_pitch_acc_rate = nvl(p_engine_pitch_acc_rate(i),ship_objects.engine_pitch_acc_rate),
					ship_objects.engine_yaw_acc_rate = nvl(p_engine_yaw_acc_rate(i),ship_objects.engine_yaw_acc_rate),
					ship_objects.engine_roll_acc_rate = nvl(p_engine_roll_acc_rate(i),ship_objects.engine_roll_acc_rate),
					ship_objects.engine_pitch_rate_maximum = nvl(p_engine_pitch_rate_maximum(i),ship_objects.engine_pitch_rate_maximum),
					ship_objects.engine_yaw_rate_maximum = nvl(p_engine_yaw_rate_maximum(i),ship_objects.engine_yaw_rate_maximum),
					ship_objects.engine_roll_rate_maximum = nvl(p_engine_roll_rate_maximum(i),ship_objects.engine_roll_rate_maximum),
					ship_objects.engine_speed_maximum = nvl(p_engine_speed_maximum(i),ship_objects.engine_speed_maximum),
					ship_objects.reactor_eng_generation_rate = nvl(p_reactor_eng_generation_rate(i),ship_objects.reactor_eng_generation_rate),
					ship_objects.booster_eng_maximum = nvl(p_booster_eng_maximum(i),ship_objects.booster_eng_maximum),
					ship_objects.booster_eng_recharge_rate = nvl(p_booster_eng_recharge_rate(i),ship_objects.booster_eng_recharge_rate),
					ship_objects.booster_eng_consumption_rate = nvl(p_booster_eng_consumption_rate(i),ship_objects.booster_eng_consumption_rate),
					ship_objects.booster_acc = nvl(p_booster_acc(i),ship_objects.booster_acc),
					ship_objects.booster_speed_maximum = nvl(p_booster_speed_maximum(i),ship_objects.booster_speed_maximum),
					ship_objects.droid_if_cmd_speed = nvl(p_droid_if_cmd_speed(i),ship_objects.droid_if_cmd_speed),
					ship_objects.installed_dcd = nvl(p_installed_dcd(i),ship_objects.installed_dcd),
					ship_objects.chassis_cmp_mass_maximum = nvl(p_chassis_cmp_mass_maximum(i),ship_objects.chassis_cmp_mass_maximum),
					ship_objects.cmp_creators = nvl(p_cmp_creators(i),ship_objects.cmp_creators),
					ship_objects.cargo_hold_contents_maximum = nvl(p_cargo_hold_contents_maximum(i),ship_objects.cargo_hold_contents_maximum),
					ship_objects.cargo_hold_contents_current = nvl(p_cargo_hold_contents_current(i),ship_objects.cargo_hold_contents_current),
					ship_objects.cargo_hold_contents = nvl(p_cargo_hold_contents(i),ship_objects.cargo_hold_contents)
				where
					ship_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into ship_objects
					(
					ship_objects.slide_dampener,
					ship_objects.current_chassis_hit_points,
					ship_objects.maximum_chassis_hit_points,
					ship_objects.chassis_type,
					ship_objects.cmp_armor_hp_maximum,
					ship_objects.cmp_armor_hp_current,
					ship_objects.cmp_efficiency_general,
					ship_objects.cmp_efficiency_eng,
					ship_objects.cmp_eng_maintenance,
					ship_objects.cmp_mass,
					ship_objects.cmp_crc,
					ship_objects.cmp_hp_current,
					ship_objects.cmp_hp_maximum,
					ship_objects.cmp_flags,
					ship_objects.cmp_names,
					ship_objects.weapon_damage_maximum,
					ship_objects.weapon_damage_minimum,
					ship_objects.weapon_effectiveness_shields,
					ship_objects.weapon_effectiveness_armor,
					ship_objects.weapon_eng_per_shot,
					ship_objects.weapon_refire_rate,
					ship_objects.weapon_ammo_current,
					ship_objects.weapon_ammo_maximum,
					ship_objects.weapon_ammo_type,
					ship_objects.shield_hp_front_maximum,
					ship_objects.shield_hp_back_maximum,
					ship_objects.shield_recharge_rate,
					ship_objects.capacitor_eng_maximum,
					ship_objects.capacitor_eng_recharge_rate,
					ship_objects.engine_acc_rate,
					ship_objects.engine_deceleration_rate,
					ship_objects.engine_pitch_acc_rate,
					ship_objects.engine_yaw_acc_rate,
					ship_objects.engine_roll_acc_rate,
					ship_objects.engine_pitch_rate_maximum,
					ship_objects.engine_yaw_rate_maximum,
					ship_objects.engine_roll_rate_maximum,
					ship_objects.engine_speed_maximum,
					ship_objects.reactor_eng_generation_rate,
					ship_objects.booster_eng_maximum,
					ship_objects.booster_eng_recharge_rate,
					ship_objects.booster_eng_consumption_rate,
					ship_objects.booster_acc,
					ship_objects.booster_speed_maximum,
					ship_objects.droid_if_cmd_speed,
					ship_objects.installed_dcd,
					ship_objects.chassis_cmp_mass_maximum,
					ship_objects.cmp_creators,
					ship_objects.cargo_hold_contents_maximum,
					ship_objects.cargo_hold_contents_current,
					ship_objects.cargo_hold_contents,
					ship_objects.object_id
					)
					VALUES
					(
					p_slide_dampener(i),
					p_current_chassis_hit_points(i),
					p_maximum_chassis_hit_points(i),
					p_chassis_type(i),
					p_cmp_armor_hp_maximum(i),
					p_cmp_armor_hp_current(i),
					p_cmp_efficiency_general(i),
					p_cmp_efficiency_eng(i),
					p_cmp_eng_maintenance(i),
					p_cmp_mass(i),
					p_cmp_crc(i),
					p_cmp_hp_current(i),
					p_cmp_hp_maximum(i),
					p_cmp_flags(i),
					p_cmp_names(i),
					p_weapon_damage_maximum(i),
					p_weapon_damage_minimum(i),
					p_weapon_effectiveness_shields(i),
					p_weapon_effectiveness_armor(i),
					p_weapon_eng_per_shot(i),
					p_weapon_refire_rate(i),
					p_weapon_ammo_current(i),
					p_weapon_ammo_maximum(i),
					p_weapon_ammo_type(i),
					p_shield_hp_front_maximum(i),
					p_shield_hp_back_maximum(i),
					p_shield_recharge_rate(i),
					p_capacitor_eng_maximum(i),
					p_capacitor_eng_recharge_rate(i),
					p_engine_acc_rate(i),
					p_engine_deceleration_rate(i),
					p_engine_pitch_acc_rate(i),
					p_engine_yaw_acc_rate(i),
					p_engine_roll_acc_rate(i),
					p_engine_pitch_rate_maximum(i),
					p_engine_yaw_rate_maximum(i),
					p_engine_roll_rate_maximum(i),
					p_engine_speed_maximum(i),
					p_reactor_eng_generation_rate(i),
					p_booster_eng_maximum(i),
					p_booster_eng_recharge_rate(i),
					p_booster_eng_consumption_rate(i),
					p_booster_acc(i),
					p_booster_speed_maximum(i),
					p_droid_if_cmd_speed(i),
					p_installed_dcd(i),
					p_chassis_cmp_mass_maximum(i),
					p_cmp_creators(i),
					p_cargo_hold_contents_maximum(i),
					p_cargo_hold_contents_current(i),
					p_cargo_hold_contents(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into ship_objects
			(
				ship_objects.slide_dampener,
				ship_objects.current_chassis_hit_points,
				ship_objects.maximum_chassis_hit_points,
				ship_objects.chassis_type,
				ship_objects.cmp_armor_hp_maximum,
				ship_objects.cmp_armor_hp_current,
				ship_objects.cmp_efficiency_general,
				ship_objects.cmp_efficiency_eng,
				ship_objects.cmp_eng_maintenance,
				ship_objects.cmp_mass,
				ship_objects.cmp_crc,
				ship_objects.cmp_hp_current,
				ship_objects.cmp_hp_maximum,
				ship_objects.cmp_flags,
				ship_objects.cmp_names,
				ship_objects.weapon_damage_maximum,
				ship_objects.weapon_damage_minimum,
				ship_objects.weapon_effectiveness_shields,
				ship_objects.weapon_effectiveness_armor,
				ship_objects.weapon_eng_per_shot,
				ship_objects.weapon_refire_rate,
				ship_objects.weapon_ammo_current,
				ship_objects.weapon_ammo_maximum,
				ship_objects.weapon_ammo_type,
				ship_objects.shield_hp_front_maximum,
				ship_objects.shield_hp_back_maximum,
				ship_objects.shield_recharge_rate,
				ship_objects.capacitor_eng_maximum,
				ship_objects.capacitor_eng_recharge_rate,
				ship_objects.engine_acc_rate,
				ship_objects.engine_deceleration_rate,
				ship_objects.engine_pitch_acc_rate,
				ship_objects.engine_yaw_acc_rate,
				ship_objects.engine_roll_acc_rate,
				ship_objects.engine_pitch_rate_maximum,
				ship_objects.engine_yaw_rate_maximum,
				ship_objects.engine_roll_rate_maximum,
				ship_objects.engine_speed_maximum,
				ship_objects.reactor_eng_generation_rate,
				ship_objects.booster_eng_maximum,
				ship_objects.booster_eng_recharge_rate,
				ship_objects.booster_eng_consumption_rate,
				ship_objects.booster_acc,
				ship_objects.booster_speed_maximum,
				ship_objects.droid_if_cmd_speed,
				ship_objects.installed_dcd,
				ship_objects.chassis_cmp_mass_maximum,
				ship_objects.cmp_creators,
				ship_objects.cargo_hold_contents_maximum,
				ship_objects.cargo_hold_contents_current,
				ship_objects.cargo_hold_contents,
				ship_objects.object_id
			)
			VALUES
			(
				p_slide_dampener(i),
				p_current_chassis_hit_points(i),
				p_maximum_chassis_hit_points(i),
				p_chassis_type(i),
				p_cmp_armor_hp_maximum(i),
				p_cmp_armor_hp_current(i),
				p_cmp_efficiency_general(i),
				p_cmp_efficiency_eng(i),
				p_cmp_eng_maintenance(i),
				p_cmp_mass(i),
				p_cmp_crc(i),
				p_cmp_hp_current(i),
				p_cmp_hp_maximum(i),
				p_cmp_flags(i),
				p_cmp_names(i),
				p_weapon_damage_maximum(i),
				p_weapon_damage_minimum(i),
				p_weapon_effectiveness_shields(i),
				p_weapon_effectiveness_armor(i),
				p_weapon_eng_per_shot(i),
				p_weapon_refire_rate(i),
				p_weapon_ammo_current(i),
				p_weapon_ammo_maximum(i),
				p_weapon_ammo_type(i),
				p_shield_hp_front_maximum(i),
				p_shield_hp_back_maximum(i),
				p_shield_recharge_rate(i),
				p_capacitor_eng_maximum(i),
				p_capacitor_eng_recharge_rate(i),
				p_engine_acc_rate(i),
				p_engine_deceleration_rate(i),
				p_engine_pitch_acc_rate(i),
				p_engine_yaw_acc_rate(i),
				p_engine_roll_acc_rate(i),
				p_engine_pitch_rate_maximum(i),
				p_engine_yaw_rate_maximum(i),
				p_engine_roll_rate_maximum(i),
				p_engine_speed_maximum(i),
				p_reactor_eng_generation_rate(i),
				p_booster_eng_maximum(i),
				p_booster_eng_recharge_rate(i),
				p_booster_eng_consumption_rate(i),
				p_booster_acc(i),
				p_booster_speed_maximum(i),
				p_droid_if_cmd_speed(i),
				p_installed_dcd(i),
				p_chassis_cmp_mass_maximum(i),
				p_cmp_creators(i),
				p_cargo_hold_contents_maximum(i),
				p_cargo_hold_contents_current(i),
				p_cargo_hold_contents(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_ship_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_ship_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','slide_dampener','float',to_char(p_slide_dampener(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','current_chassis_hit_points','float',to_char(p_current_chassis_hit_points(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','maximum_chassis_hit_points','float',to_char(p_maximum_chassis_hit_points(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','chassis_type','int',to_char(p_chassis_type(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_armor_hp_maximum','varchar2',p_cmp_armor_hp_maximum(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_armor_hp_current','varchar2',p_cmp_armor_hp_current(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_efficiency_general','varchar2',p_cmp_efficiency_general(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_efficiency_eng','varchar2',p_cmp_efficiency_eng(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_eng_maintenance','varchar2',p_cmp_eng_maintenance(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_mass','varchar2',p_cmp_mass(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_crc','varchar2',p_cmp_crc(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_hp_current','varchar2',p_cmp_hp_current(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_hp_maximum','varchar2',p_cmp_hp_maximum(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_flags','varchar2',p_cmp_flags(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_names','varchar2',p_cmp_names(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_damage_maximum','varchar2',p_weapon_damage_maximum(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_damage_minimum','varchar2',p_weapon_damage_minimum(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_effectiveness_shields','varchar2',p_weapon_effectiveness_shields(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_effectiveness_armor','varchar2',p_weapon_effectiveness_armor(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_eng_per_shot','varchar2',p_weapon_eng_per_shot(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_refire_rate','varchar2',p_weapon_refire_rate(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_ammo_current','varchar2',p_weapon_ammo_current(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_ammo_maximum','varchar2',p_weapon_ammo_maximum(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','weapon_ammo_type','varchar2',p_weapon_ammo_type(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','shield_hp_front_maximum','float',to_char(p_shield_hp_front_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','shield_hp_back_maximum','float',to_char(p_shield_hp_back_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','shield_recharge_rate','float',to_char(p_shield_recharge_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','capacitor_eng_maximum','float',to_char(p_capacitor_eng_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','capacitor_eng_recharge_rate','float',to_char(p_capacitor_eng_recharge_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_acc_rate','float',to_char(p_engine_acc_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_deceleration_rate','float',to_char(p_engine_deceleration_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_pitch_acc_rate','float',to_char(p_engine_pitch_acc_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_yaw_acc_rate','float',to_char(p_engine_yaw_acc_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_roll_acc_rate','float',to_char(p_engine_roll_acc_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_pitch_rate_maximum','float',to_char(p_engine_pitch_rate_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_yaw_rate_maximum','float',to_char(p_engine_yaw_rate_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_roll_rate_maximum','float',to_char(p_engine_roll_rate_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','engine_speed_maximum','float',to_char(p_engine_speed_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','reactor_eng_generation_rate','float',to_char(p_reactor_eng_generation_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','booster_eng_maximum','float',to_char(p_booster_eng_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','booster_eng_recharge_rate','float',to_char(p_booster_eng_recharge_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','booster_eng_consumption_rate','float',to_char(p_booster_eng_consumption_rate(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','booster_acc','float',to_char(p_booster_acc(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','booster_speed_maximum','float',to_char(p_booster_speed_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','droid_if_cmd_speed','float',to_char(p_droid_if_cmd_speed(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','installed_dcd','number',p_installed_dcd(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','chassis_cmp_mass_maximum','float',to_char(p_chassis_cmp_mass_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cmp_creators','varchar2',p_cmp_creators(m_error_index));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cargo_hold_contents_maximum','number',to_char(p_cargo_hold_contents_maximum(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cargo_hold_contents_current','number',to_char(p_cargo_hold_contents_current(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_ship_obj','cargo_hold_contents','varchar2',p_cargo_hold_contents(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_ship_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_ship_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete ship_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_static_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		null;
	end;

	procedure add_static_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into static_objects
		(
			static_objects.object_id
		)
		VALUES
		(
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_static_obj : dup_val_on_index error.');
			END IF;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into static_objects
			(
				static_objects.object_id
			)
			VALUES
			(
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_static_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_static_obj','object_id','number',p_object_id(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_static_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_static_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		null;
	end;

	procedure save_tangible_obj( p_object_id VAOFSTRING, p_max_hit_points VAOFNUMBER, p_owner_id VAOFSTRING, p_visible VAOFSTRING, p_appearance_data VAOFSTRING, p_interest_radius VAOFNUMBER, p_pvp_type VAOFNUMBER, p_pvp_faction VAOFNUMBER, p_damage_taken VAOFNUMBER, p_custom_appearance VAOFSTRING, p_count VAOFNUMBER, p_condition VAOFNUMBER, p_creator_id VAOFSTRING, p_source_draft_schematic VAOFNUMBER, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update tangible_objects set
			tangible_objects.max_hit_points = nvl(p_max_hit_points(i),tangible_objects.max_hit_points),
			tangible_objects.owner_id = nvl(p_owner_id(i),tangible_objects.owner_id),
			tangible_objects.visible = nvl(p_visible(i),tangible_objects.visible),
			tangible_objects.appearance_data = nvl(p_appearance_data(i),tangible_objects.appearance_data),
			tangible_objects.interest_radius = nvl(p_interest_radius(i),tangible_objects.interest_radius),
			tangible_objects.pvp_type = nvl(p_pvp_type(i),tangible_objects.pvp_type),
			tangible_objects.pvp_faction = nvl(p_pvp_faction(i),tangible_objects.pvp_faction),
			tangible_objects.damage_taken = nvl(p_damage_taken(i),tangible_objects.damage_taken),
			tangible_objects.custom_appearance = nvl(p_custom_appearance(i),tangible_objects.custom_appearance),
			tangible_objects.count = nvl(p_count(i),tangible_objects.count),
			tangible_objects.condition = nvl(p_condition(i),tangible_objects.condition),
			tangible_objects.creator_id = nvl(p_creator_id(i),tangible_objects.creator_id),
			tangible_objects.source_draft_schematic = nvl(p_source_draft_schematic(i),tangible_objects.source_draft_schematic)
		where
			tangible_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update tangible_objects set
					tangible_objects.max_hit_points = nvl(p_max_hit_points(i),tangible_objects.max_hit_points),
					tangible_objects.owner_id = nvl(p_owner_id(i),tangible_objects.owner_id),
					tangible_objects.visible = nvl(p_visible(i),tangible_objects.visible),
					tangible_objects.appearance_data = nvl(p_appearance_data(i),tangible_objects.appearance_data),
					tangible_objects.interest_radius = nvl(p_interest_radius(i),tangible_objects.interest_radius),
					tangible_objects.pvp_type = nvl(p_pvp_type(i),tangible_objects.pvp_type),
					tangible_objects.pvp_faction = nvl(p_pvp_faction(i),tangible_objects.pvp_faction),
					tangible_objects.damage_taken = nvl(p_damage_taken(i),tangible_objects.damage_taken),
					tangible_objects.custom_appearance = nvl(p_custom_appearance(i),tangible_objects.custom_appearance),
					tangible_objects.count = nvl(p_count(i),tangible_objects.count),
					tangible_objects.condition = nvl(p_condition(i),tangible_objects.condition),
					tangible_objects.creator_id = nvl(p_creator_id(i),tangible_objects.creator_id),
					tangible_objects.source_draft_schematic = nvl(p_source_draft_schematic(i),tangible_objects.source_draft_schematic)
					where
					tangible_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_tangible_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_tangible_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','max_hit_points','int',to_char(p_max_hit_points(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','owner_id','int',p_owner_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','visible','char',p_visible(m_error_index));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','appearance_data','varchar',p_appearance_data(m_error_index));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','interest_radius','int',to_char(p_interest_radius(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','pvp_type','int',to_char(p_pvp_type(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','pvp_faction','int',to_char(p_pvp_faction(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','damage_taken','int',to_char(p_damage_taken(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','custom_appearance','varchar2',p_custom_appearance(m_error_index));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','count','int',to_char(p_count(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','condition','int',to_char(p_condition(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','creator_id','number',p_creator_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_tangible_obj','source_draft_schematic','int',to_char(p_source_draft_schematic(m_error_index)));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_tangible_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_tangible_obj( p_object_id VAOFSTRING, p_max_hit_points VAOFNUMBER, p_owner_id VAOFSTRING, p_visible VAOFSTRING, p_appearance_data VAOFSTRING, p_interest_radius VAOFNUMBER, p_pvp_type VAOFNUMBER, p_pvp_faction VAOFNUMBER, p_damage_taken VAOFNUMBER, p_custom_appearance VAOFSTRING, p_count VAOFNUMBER, p_condition VAOFNUMBER, p_creator_id VAOFSTRING, p_source_draft_schematic VAOFNUMBER, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into tangible_objects
		(
			tangible_objects.max_hit_points,
			tangible_objects.owner_id,
			tangible_objects.visible,
			tangible_objects.appearance_data,
			tangible_objects.interest_radius,
			tangible_objects.pvp_type,
			tangible_objects.pvp_faction,
			tangible_objects.damage_taken,
			tangible_objects.custom_appearance,
			tangible_objects.count,
			tangible_objects.condition,
			tangible_objects.creator_id,
			tangible_objects.source_draft_schematic,
			tangible_objects.object_id
		)
		VALUES
		(
			p_max_hit_points(i),
			p_owner_id(i),
			p_visible(i),
			p_appearance_data(i),
			p_interest_radius(i),
			p_pvp_type(i),
			p_pvp_faction(i),
			p_damage_taken(i),
			p_custom_appearance(i),
			p_count(i),
			p_condition(i),
			p_creator_id(i),
			p_source_draft_schematic(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_tangible_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE tangible_objects Set
					tangible_objects.max_hit_points = nvl(p_max_hit_points(i),tangible_objects.max_hit_points),
					tangible_objects.owner_id = nvl(p_owner_id(i),tangible_objects.owner_id),
					tangible_objects.visible = nvl(p_visible(i),tangible_objects.visible),
					tangible_objects.appearance_data = nvl(p_appearance_data(i),tangible_objects.appearance_data),
					tangible_objects.interest_radius = nvl(p_interest_radius(i),tangible_objects.interest_radius),
					tangible_objects.pvp_type = nvl(p_pvp_type(i),tangible_objects.pvp_type),
					tangible_objects.pvp_faction = nvl(p_pvp_faction(i),tangible_objects.pvp_faction),
					tangible_objects.damage_taken = nvl(p_damage_taken(i),tangible_objects.damage_taken),
					tangible_objects.custom_appearance = nvl(p_custom_appearance(i),tangible_objects.custom_appearance),
					tangible_objects.count = nvl(p_count(i),tangible_objects.count),
					tangible_objects.condition = nvl(p_condition(i),tangible_objects.condition),
					tangible_objects.creator_id = nvl(p_creator_id(i),tangible_objects.creator_id),
					tangible_objects.source_draft_schematic = nvl(p_source_draft_schematic(i),tangible_objects.source_draft_schematic)
				where
					tangible_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into tangible_objects
					(
					tangible_objects.max_hit_points,
					tangible_objects.owner_id,
					tangible_objects.visible,
					tangible_objects.appearance_data,
					tangible_objects.interest_radius,
					tangible_objects.pvp_type,
					tangible_objects.pvp_faction,
					tangible_objects.damage_taken,
					tangible_objects.custom_appearance,
					tangible_objects.count,
					tangible_objects.condition,
					tangible_objects.creator_id,
					tangible_objects.source_draft_schematic,
					tangible_objects.object_id
					)
					VALUES
					(
					p_max_hit_points(i),
					p_owner_id(i),
					p_visible(i),
					p_appearance_data(i),
					p_interest_radius(i),
					p_pvp_type(i),
					p_pvp_faction(i),
					p_damage_taken(i),
					p_custom_appearance(i),
					p_count(i),
					p_condition(i),
					p_creator_id(i),
					p_source_draft_schematic(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into tangible_objects
			(
				tangible_objects.max_hit_points,
				tangible_objects.owner_id,
				tangible_objects.visible,
				tangible_objects.appearance_data,
				tangible_objects.interest_radius,
				tangible_objects.pvp_type,
				tangible_objects.pvp_faction,
				tangible_objects.damage_taken,
				tangible_objects.custom_appearance,
				tangible_objects.count,
				tangible_objects.condition,
				tangible_objects.creator_id,
				tangible_objects.source_draft_schematic,
				tangible_objects.object_id
			)
			VALUES
			(
				p_max_hit_points(i),
				p_owner_id(i),
				p_visible(i),
				p_appearance_data(i),
				p_interest_radius(i),
				p_pvp_type(i),
				p_pvp_faction(i),
				p_damage_taken(i),
				p_custom_appearance(i),
				p_count(i),
				p_condition(i),
				p_creator_id(i),
				p_source_draft_schematic(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_tangible_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_tangible_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','max_hit_points','int',to_char(p_max_hit_points(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','owner_id','int',p_owner_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','visible','char',p_visible(m_error_index));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','appearance_data','varchar',p_appearance_data(m_error_index));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','interest_radius','int',to_char(p_interest_radius(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','pvp_type','int',to_char(p_pvp_type(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','pvp_faction','int',to_char(p_pvp_faction(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','damage_taken','int',to_char(p_damage_taken(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','custom_appearance','varchar2',p_custom_appearance(m_error_index));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','count','int',to_char(p_count(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','condition','int',to_char(p_condition(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','creator_id','number',p_creator_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_tangible_obj','source_draft_schematic','int',to_char(p_source_draft_schematic(m_error_index)));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_tangible_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_tangible_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete tangible_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_token_obj( p_object_id VAOFSTRING, p_reference VAOFSTRING, p_target_server_template_name VAOFSTRING, p_target_shared_template_name VAOFSTRING, p_waypoint VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update token_objects set
			token_objects.reference = nvl(p_reference(i),token_objects.reference),
			token_objects.target_server_template_name = nvl(p_target_server_template_name(i),token_objects.target_server_template_name),
			token_objects.target_shared_template_name = nvl(p_target_shared_template_name(i),token_objects.target_shared_template_name),
			token_objects.waypoint = nvl(p_waypoint(i),token_objects.waypoint)
		where
			token_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update token_objects set
					token_objects.reference = nvl(p_reference(i),token_objects.reference),
					token_objects.target_server_template_name = nvl(p_target_server_template_name(i),token_objects.target_server_template_name),
					token_objects.target_shared_template_name = nvl(p_target_shared_template_name(i),token_objects.target_shared_template_name),
					token_objects.waypoint = nvl(p_waypoint(i),token_objects.waypoint)
					where
					token_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_token_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_token_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_token_obj','reference','number',p_reference(m_error_index));
								db_error_logger.dblogerror_values('persister.save_token_obj','target_server_template_name','varchar2',p_target_server_template_name(m_error_index));
								db_error_logger.dblogerror_values('persister.save_token_obj','target_shared_template_name','varchar2',p_target_shared_template_name(m_error_index));
								db_error_logger.dblogerror_values('persister.save_token_obj','waypoint','number',p_waypoint(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_token_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_token_obj( p_object_id VAOFSTRING, p_reference VAOFSTRING, p_target_server_template_name VAOFSTRING, p_target_shared_template_name VAOFSTRING, p_waypoint VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into token_objects
		(
			token_objects.reference,
			token_objects.target_server_template_name,
			token_objects.target_shared_template_name,
			token_objects.waypoint,
			token_objects.object_id
		)
		VALUES
		(
			p_reference(i),
			p_target_server_template_name(i),
			p_target_shared_template_name(i),
			p_waypoint(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_token_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE token_objects Set
					token_objects.reference = nvl(p_reference(i),token_objects.reference),
					token_objects.target_server_template_name = nvl(p_target_server_template_name(i),token_objects.target_server_template_name),
					token_objects.target_shared_template_name = nvl(p_target_shared_template_name(i),token_objects.target_shared_template_name),
					token_objects.waypoint = nvl(p_waypoint(i),token_objects.waypoint)
				where
					token_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into token_objects
					(
					token_objects.reference,
					token_objects.target_server_template_name,
					token_objects.target_shared_template_name,
					token_objects.waypoint,
					token_objects.object_id
					)
					VALUES
					(
					p_reference(i),
					p_target_server_template_name(i),
					p_target_shared_template_name(i),
					p_waypoint(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into token_objects
			(
				token_objects.reference,
				token_objects.target_server_template_name,
				token_objects.target_shared_template_name,
				token_objects.waypoint,
				token_objects.object_id
			)
			VALUES
			(
				p_reference(i),
				p_target_server_template_name(i),
				p_target_shared_template_name(i),
				p_waypoint(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_token_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_token_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_token_obj','reference','number',p_reference(m_error_index));
						db_error_logger.dblogerror_values('persister.add_token_obj','target_server_template_name','varchar2',p_target_server_template_name(m_error_index));
						db_error_logger.dblogerror_values('persister.add_token_obj','target_shared_template_name','varchar2',p_target_shared_template_name(m_error_index));
						db_error_logger.dblogerror_values('persister.add_token_obj','waypoint','number',p_waypoint(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_token_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_token_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete token_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_universe_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		null;
	end;

	procedure add_universe_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into universe_objects
		(
			universe_objects.object_id
		)
		VALUES
		(
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_universe_obj : dup_val_on_index error.');
			END IF;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into universe_objects
			(
				universe_objects.object_id
			)
			VALUES
			(
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_universe_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_universe_obj','object_id','number',p_object_id(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_universe_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_universe_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		null;
	end;

	procedure save_vehicle_obj( p_object_id VAOFSTRING, p_bogus VAOFNUMBER, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update vehicle_objects set
			vehicle_objects.bogus = nvl(p_bogus(i),vehicle_objects.bogus)
		where
			vehicle_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update vehicle_objects set
					vehicle_objects.bogus = nvl(p_bogus(i),vehicle_objects.bogus)
					where
					vehicle_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_vehicle_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_vehicle_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_vehicle_obj','bogus','int',to_char(p_bogus(m_error_index)));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_vehicle_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_vehicle_obj( p_object_id VAOFSTRING, p_bogus VAOFNUMBER, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into vehicle_objects
		(
			vehicle_objects.bogus,
			vehicle_objects.object_id
		)
		VALUES
		(
			p_bogus(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_vehicle_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE vehicle_objects Set
					vehicle_objects.bogus = nvl(p_bogus(i),vehicle_objects.bogus)
				where
					vehicle_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into vehicle_objects
					(
					vehicle_objects.bogus,
					vehicle_objects.object_id
					)
					VALUES
					(
					p_bogus(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into vehicle_objects
			(
				vehicle_objects.bogus,
				vehicle_objects.object_id
			)
			VALUES
			(
				p_bogus(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_vehicle_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_vehicle_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_vehicle_obj','bogus','int',to_char(p_bogus(m_error_index)));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_vehicle_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_vehicle_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete vehicle_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_weapon_obj( p_object_id VAOFSTRING, p_min_damage VAOFNUMBER, p_max_damage VAOFNUMBER, p_damage_type VAOFNUMBER, p_elemental_type VAOFNUMBER, p_elemental_value VAOFNUMBER, p_attack_speed VAOFNUMBER, p_wound_chance VAOFNUMBER, p_accuracy VAOFNUMBER, p_attack_cost VAOFNUMBER, p_damage_radius VAOFNUMBER, p_min_range VAOFNUMBER, p_max_range VAOFNUMBER, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		update weapon_objects set
			weapon_objects.min_damage = nvl(p_min_damage(i),weapon_objects.min_damage),
			weapon_objects.max_damage = nvl(p_max_damage(i),weapon_objects.max_damage),
			weapon_objects.damage_type = nvl(p_damage_type(i),weapon_objects.damage_type),
			weapon_objects.elemental_type = nvl(p_elemental_type(i),weapon_objects.elemental_type),
			weapon_objects.elemental_value = nvl(p_elemental_value(i),weapon_objects.elemental_value),
			weapon_objects.attack_speed = nvl(p_attack_speed(i),weapon_objects.attack_speed),
			weapon_objects.wound_chance = nvl(p_wound_chance(i),weapon_objects.wound_chance),
			weapon_objects.accuracy = nvl(p_accuracy(i),weapon_objects.accuracy),
			weapon_objects.attack_cost = nvl(p_attack_cost(i),weapon_objects.attack_cost),
			weapon_objects.damage_radius = nvl(p_damage_radius(i),weapon_objects.damage_radius),
			weapon_objects.min_range = nvl(p_min_range(i),weapon_objects.min_range),
			weapon_objects.max_range = nvl(p_max_range(i),weapon_objects.max_range)
		where
			weapon_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update weapon_objects set
					weapon_objects.min_damage = nvl(p_min_damage(i),weapon_objects.min_damage),
					weapon_objects.max_damage = nvl(p_max_damage(i),weapon_objects.max_damage),
					weapon_objects.damage_type = nvl(p_damage_type(i),weapon_objects.damage_type),
					weapon_objects.elemental_type = nvl(p_elemental_type(i),weapon_objects.elemental_type),
					weapon_objects.elemental_value = nvl(p_elemental_value(i),weapon_objects.elemental_value),
					weapon_objects.attack_speed = nvl(p_attack_speed(i),weapon_objects.attack_speed),
					weapon_objects.wound_chance = nvl(p_wound_chance(i),weapon_objects.wound_chance),
					weapon_objects.accuracy = nvl(p_accuracy(i),weapon_objects.accuracy),
					weapon_objects.attack_cost = nvl(p_attack_cost(i),weapon_objects.attack_cost),
					weapon_objects.damage_radius = nvl(p_damage_radius(i),weapon_objects.damage_radius),
					weapon_objects.min_range = nvl(p_min_range(i),weapon_objects.min_range),
					weapon_objects.max_range = nvl(p_max_range(i),weapon_objects.max_range)
					where
					weapon_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_weapon_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_weapon_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','min_damage','int',to_char(p_min_damage(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','max_damage','int',to_char(p_max_damage(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','damage_type','int',to_char(p_damage_type(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','elemental_type','int',to_char(p_elemental_type(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','elemental_value','int',to_char(p_elemental_value(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','attack_speed','float',to_char(p_attack_speed(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','wound_chance','float',to_char(p_wound_chance(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','accuracy','int',to_char(p_accuracy(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','attack_cost','int',to_char(p_attack_cost(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','damage_radius','float',to_char(p_damage_radius(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','min_range','float',to_char(p_min_range(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_weapon_obj','max_range','float',to_char(p_max_range(m_error_index)));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_weapon_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_weapon_obj( p_object_id VAOFSTRING, p_min_damage VAOFNUMBER, p_max_damage VAOFNUMBER, p_damage_type VAOFNUMBER, p_elemental_type VAOFNUMBER, p_elemental_value VAOFNUMBER, p_attack_speed VAOFNUMBER, p_wound_chance VAOFNUMBER, p_accuracy VAOFNUMBER, p_attack_cost VAOFNUMBER, p_damage_radius VAOFNUMBER, p_min_range VAOFNUMBER, p_max_range VAOFNUMBER, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=1;
	begin
		FORALL i IN 1..p_chunk_size
		insert into weapon_objects
		(
			weapon_objects.min_damage,
			weapon_objects.max_damage,
			weapon_objects.damage_type,
			weapon_objects.elemental_type,
			weapon_objects.elemental_value,
			weapon_objects.attack_speed,
			weapon_objects.wound_chance,
			weapon_objects.accuracy,
			weapon_objects.attack_cost,
			weapon_objects.damage_radius,
			weapon_objects.min_range,
			weapon_objects.max_range,
			weapon_objects.object_id
		)
		VALUES
		(
			p_min_damage(i),
			p_max_damage(i),
			p_damage_type(i),
			p_elemental_type(i),
			p_elemental_value(i),
			p_attack_speed(i),
			p_wound_chance(i),
			p_accuracy(i),
			p_attack_cost(i),
			p_damage_radius(i),
			p_min_range(i),
			p_max_range(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_weapon_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE weapon_objects Set
					weapon_objects.min_damage = nvl(p_min_damage(i),weapon_objects.min_damage),
					weapon_objects.max_damage = nvl(p_max_damage(i),weapon_objects.max_damage),
					weapon_objects.damage_type = nvl(p_damage_type(i),weapon_objects.damage_type),
					weapon_objects.elemental_type = nvl(p_elemental_type(i),weapon_objects.elemental_type),
					weapon_objects.elemental_value = nvl(p_elemental_value(i),weapon_objects.elemental_value),
					weapon_objects.attack_speed = nvl(p_attack_speed(i),weapon_objects.attack_speed),
					weapon_objects.wound_chance = nvl(p_wound_chance(i),weapon_objects.wound_chance),
					weapon_objects.accuracy = nvl(p_accuracy(i),weapon_objects.accuracy),
					weapon_objects.attack_cost = nvl(p_attack_cost(i),weapon_objects.attack_cost),
					weapon_objects.damage_radius = nvl(p_damage_radius(i),weapon_objects.damage_radius),
					weapon_objects.min_range = nvl(p_min_range(i),weapon_objects.min_range),
					weapon_objects.max_range = nvl(p_max_range(i),weapon_objects.max_range)
				where
					weapon_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into weapon_objects
					(
					weapon_objects.min_damage,
					weapon_objects.max_damage,
					weapon_objects.damage_type,
					weapon_objects.elemental_type,
					weapon_objects.elemental_value,
					weapon_objects.attack_speed,
					weapon_objects.wound_chance,
					weapon_objects.accuracy,
					weapon_objects.attack_cost,
					weapon_objects.damage_radius,
					weapon_objects.min_range,
					weapon_objects.max_range,
					weapon_objects.object_id
					)
					VALUES
					(
					p_min_damage(i),
					p_max_damage(i),
					p_damage_type(i),
					p_elemental_type(i),
					p_elemental_value(i),
					p_attack_speed(i),
					p_wound_chance(i),
					p_accuracy(i),
					p_attack_cost(i),
					p_damage_radius(i),
					p_min_range(i),
					p_max_range(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into weapon_objects
			(
				weapon_objects.min_damage,
				weapon_objects.max_damage,
				weapon_objects.damage_type,
				weapon_objects.elemental_type,
				weapon_objects.elemental_value,
				weapon_objects.attack_speed,
				weapon_objects.wound_chance,
				weapon_objects.accuracy,
				weapon_objects.attack_cost,
				weapon_objects.damage_radius,
				weapon_objects.min_range,
				weapon_objects.max_range,
				weapon_objects.object_id
			)
			VALUES
			(
				p_min_damage(i),
				p_max_damage(i),
				p_damage_type(i),
				p_elemental_type(i),
				p_elemental_value(i),
				p_attack_speed(i),
				p_wound_chance(i),
				p_accuracy(i),
				p_attack_cost(i),
				p_damage_radius(i),
				p_min_range(i),
				p_max_range(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_weapon_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_weapon_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','min_damage','int',to_char(p_min_damage(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','max_damage','int',to_char(p_max_damage(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','damage_type','int',to_char(p_damage_type(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','elemental_type','int',to_char(p_elemental_type(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','elemental_value','int',to_char(p_elemental_value(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','attack_speed','float',to_char(p_attack_speed(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','wound_chance','float',to_char(p_wound_chance(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','accuracy','int',to_char(p_accuracy(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','attack_cost','int',to_char(p_attack_cost(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','damage_radius','float',to_char(p_damage_radius(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','min_range','float',to_char(p_min_range(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_weapon_obj','max_range','float',to_char(p_max_range(m_error_index)));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_weapon_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_weapon_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete weapon_objects
		where
			object_id=p_object_id(i);
	end;

	procedure save_player_quest_obj( p_object_id VAOFSTRING, p_title VAOFSTRING, p_description VAOFSTRING, p_creator VAOFSTRING, p_total_tasks VAOFNUMBER, p_difficulty VAOFNUMBER, p_task_title1 VAOFSTRING, p_task_description1 VAOFSTRING, p_task_title2 VAOFSTRING, p_task_description2 VAOFSTRING, p_task_title3 VAOFSTRING, p_task_description3 VAOFSTRING, p_task_title4 VAOFSTRING, p_task_description4 VAOFSTRING, p_task_title5 VAOFSTRING, p_task_description5 VAOFSTRING, p_task_title6 VAOFSTRING, p_task_description6 VAOFSTRING, p_task_title7 VAOFSTRING, p_task_description7 VAOFSTRING, p_task_title8 VAOFSTRING, p_task_description8 VAOFSTRING, p_task_title9 VAOFSTRING, p_task_description9 VAOFSTRING, p_task_title10 VAOFSTRING, p_task_description10 VAOFSTRING, p_task_title11 VAOFSTRING, p_task_description11 VAOFSTRING, p_task_title12 VAOFSTRING, p_task_description12 VAOFSTRING, p_chunk_size number )
	as

	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=0;
	begin
		FORALL i IN 1..p_chunk_size
		update player_quest_objects set
			player_quest_objects.title = nvl(p_title(i),player_quest_objects.title),
			player_quest_objects.description = nvl(p_description(i),player_quest_objects.description),
			player_quest_objects.creator = nvl(p_creator(i),player_quest_objects.creator),
			player_quest_objects.total_tasks = nvl(p_total_tasks(i),player_quest_objects.total_tasks),
			player_quest_objects.difficulty = nvl(p_difficulty(i),player_quest_objects.difficulty),
			player_quest_objects.task_title1 = nvl(p_task_title1(i),player_quest_objects.task_title1),
			player_quest_objects.task_description1 = nvl(p_task_description1(i),player_quest_objects.task_description1),
			player_quest_objects.task_title2 = nvl(p_task_title2(i),player_quest_objects.task_title2),
			player_quest_objects.task_description2 = nvl(p_task_description2(i),player_quest_objects.task_description2),
			player_quest_objects.task_title3 = nvl(p_task_title3(i),player_quest_objects.task_title3),
			player_quest_objects.task_description3 = nvl(p_task_description3(i),player_quest_objects.task_description3),
			player_quest_objects.task_title4 = nvl(p_task_title4(i),player_quest_objects.task_title4),
			player_quest_objects.task_description4 = nvl(p_task_description4(i),player_quest_objects.task_description4),
			player_quest_objects.task_title5 = nvl(p_task_title5(i),player_quest_objects.task_title5),
			player_quest_objects.task_description5 = nvl(p_task_description5(i),player_quest_objects.task_description5),
			player_quest_objects.task_title6 = nvl(p_task_title6(i),player_quest_objects.task_title6),
			player_quest_objects.task_description6 = nvl(p_task_description6(i),player_quest_objects.task_description6),
			player_quest_objects.task_title7 = nvl(p_task_title7(i),player_quest_objects.task_title7),
			player_quest_objects.task_description7 = nvl(p_task_description7(i),player_quest_objects.task_description7),
			player_quest_objects.task_title8 = nvl(p_task_title8(i),player_quest_objects.task_title8),
			player_quest_objects.task_description8 = nvl(p_task_description8(i),player_quest_objects.task_description8),
			player_quest_objects.task_title9 = nvl(p_task_title9(i),player_quest_objects.task_title9),
			player_quest_objects.task_description9 = nvl(p_task_description9(i),player_quest_objects.task_description9),
			player_quest_objects.task_title10 = nvl(p_task_title10(i),player_quest_objects.task_title10),
			player_quest_objects.task_description10 = nvl(p_task_description10(i),player_quest_objects.task_description10),
			player_quest_objects.task_title11 = nvl(p_task_title11(i),player_quest_objects.task_title11),
			player_quest_objects.task_description11 = nvl(p_task_description11(i),player_quest_objects.task_description11),
			player_quest_objects.task_title12 = nvl(p_task_title12(i),player_quest_objects.task_title12),
			player_quest_objects.task_description12 = nvl(p_task_description12(i),player_quest_objects.task_description12)
		where
			player_quest_objects.object_id=p_object_id(i);
	exception
		when others then
			begin
				FOR i IN 1..p_chunk_size LOOP
					m_error_index := i;
					update player_quest_objects set
					player_quest_objects.title = nvl(p_title(i),player_quest_objects.title),
					player_quest_objects.description = nvl(p_description(i),player_quest_objects.description),
					player_quest_objects.creator = nvl(p_creator(i),player_quest_objects.creator),
					player_quest_objects.total_tasks = nvl(p_total_tasks(i),player_quest_objects.total_tasks),
					player_quest_objects.difficulty = nvl(p_difficulty(i),player_quest_objects.difficulty),
					player_quest_objects.task_title1 = nvl(p_task_title1(i),player_quest_objects.task_title1),
					player_quest_objects.task_description1 = nvl(p_task_description1(i),player_quest_objects.task_description1),
					player_quest_objects.task_title2 = nvl(p_task_title2(i),player_quest_objects.task_title2),
					player_quest_objects.task_description2 = nvl(p_task_description2(i),player_quest_objects.task_description2),
					player_quest_objects.task_title3 = nvl(p_task_title3(i),player_quest_objects.task_title3),
					player_quest_objects.task_description3 = nvl(p_task_description3(i),player_quest_objects.task_description3),
					player_quest_objects.task_title4 = nvl(p_task_title4(i),player_quest_objects.task_title4),
					player_quest_objects.task_description4 = nvl(p_task_description4(i),player_quest_objects.task_description4),
					player_quest_objects.task_title5 = nvl(p_task_title5(i),player_quest_objects.task_title5),
					player_quest_objects.task_description5 = nvl(p_task_description5(i),player_quest_objects.task_description5),
					player_quest_objects.task_title6 = nvl(p_task_title6(i),player_quest_objects.task_title6),
					player_quest_objects.task_description6 = nvl(p_task_description6(i),player_quest_objects.task_description6),
					player_quest_objects.task_title7 = nvl(p_task_title7(i),player_quest_objects.task_title7),
					player_quest_objects.task_description7 = nvl(p_task_description7(i),player_quest_objects.task_description7),
					player_quest_objects.task_title8 = nvl(p_task_title8(i),player_quest_objects.task_title8),
					player_quest_objects.task_description8 = nvl(p_task_description8(i),player_quest_objects.task_description8),
					player_quest_objects.task_title9 = nvl(p_task_title9(i),player_quest_objects.task_title9),
					player_quest_objects.task_description9 = nvl(p_task_description9(i),player_quest_objects.task_description9),
					player_quest_objects.task_title10 = nvl(p_task_title10(i),player_quest_objects.task_title10),
					player_quest_objects.task_description10 = nvl(p_task_description10(i),player_quest_objects.task_description10),
					player_quest_objects.task_title11 = nvl(p_task_title11(i),player_quest_objects.task_title11),
					player_quest_objects.task_description11 = nvl(p_task_description11(i),player_quest_objects.task_description11),
					player_quest_objects.task_title12 = nvl(p_task_title12(i),player_quest_objects.task_title12),
					player_quest_objects.task_description12 = nvl(p_task_description12(i),player_quest_objects.task_description12)
					where
					player_quest_objects.object_id=p_object_id(i);
				end LOOP;
			exception
				when others then
					begin
						m_enable_db_logging := db_error_logger.getLogLevel();
						IF (m_enable_db_logging > 0) THEN
							db_error_logger.dblogerror(SQLCODE,'persister.save_player_quest_obj : update error.');
							IF (m_enable_db_logging > 1) THEN
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','object_id','number',p_object_id(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','title','varchar2',p_title(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','description','varchar2',p_description(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','creator','number',p_creator(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','total_tasks','int',to_char(p_total_tasks(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','difficulty','int',to_char(p_difficulty(m_error_index)));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title1','varchar2',p_task_title1(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description1','varchar2',p_task_description1(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title2','varchar2',p_task_title2(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description2','varchar2',p_task_description2(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title3','varchar2',p_task_title3(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description3','varchar2',p_task_description3(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title4','varchar2',p_task_title4(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description4','varchar2',p_task_description4(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title5','varchar2',p_task_title5(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description5','varchar2',p_task_description5(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title6','varchar2',p_task_title6(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description6','varchar2',p_task_description6(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title7','varchar2',p_task_title7(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description7','varchar2',p_task_description7(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title8','varchar2',p_task_title8(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description8','varchar2',p_task_description8(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title9','varchar2',p_task_title9(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description9','varchar2',p_task_description9(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title10','varchar2',p_task_title10(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description10','varchar2',p_task_description10(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title11','varchar2',p_task_title11(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description11','varchar2',p_task_description11(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_title12','varchar2',p_task_title12(m_error_index));
								db_error_logger.dblogerror_values('persister.save_player_quest_obj','task_description12','varchar2',p_task_description12(m_error_index));
							END IF;
						END IF;
						IF (db_error_logger.reraisecheck('persister','save_player_quest_obj') = 1) THEN
							RAISE;
						END IF;
					end;
			end;
	end;

	procedure add_player_quest_obj( p_object_id VAOFSTRING, p_title VAOFSTRING, p_description VAOFSTRING, p_creator VAOFSTRING, p_total_tasks VAOFNUMBER, p_difficulty VAOFNUMBER, p_task_title1 VAOFSTRING, p_task_description1 VAOFSTRING, p_task_title2 VAOFSTRING, p_task_description2 VAOFSTRING, p_task_title3 VAOFSTRING, p_task_description3 VAOFSTRING, p_task_title4 VAOFSTRING, p_task_description4 VAOFSTRING, p_task_title5 VAOFSTRING, p_task_description5 VAOFSTRING, p_task_title6 VAOFSTRING, p_task_description6 VAOFSTRING, p_task_title7 VAOFSTRING, p_task_description7 VAOFSTRING, p_task_title8 VAOFSTRING, p_task_description8 VAOFSTRING, p_task_title9 VAOFSTRING, p_task_description9 VAOFSTRING, p_task_title10 VAOFSTRING, p_task_description10 VAOFSTRING, p_task_title11 VAOFSTRING, p_task_description11 VAOFSTRING, p_task_title12 VAOFSTRING, p_task_description12 VAOFSTRING, p_chunk_size number )
	as
	m_enable_db_logging INTEGER := 0;
	m_error_index INTEGER :=0;
	begin
		FORALL i IN 1..p_chunk_size
		insert into player_quest_objects
		(
			player_quest_objects.title,
			player_quest_objects.description,
			player_quest_objects.creator,
			player_quest_objects.total_tasks,
			player_quest_objects.difficulty,
			player_quest_objects.task_title1,
			player_quest_objects.task_description1,
			player_quest_objects.task_title2,
			player_quest_objects.task_description2,
			player_quest_objects.task_title3,
			player_quest_objects.task_description3,
			player_quest_objects.task_title4,
			player_quest_objects.task_description4,
			player_quest_objects.task_title5,
			player_quest_objects.task_description5,
			player_quest_objects.task_title6,
			player_quest_objects.task_description6,
			player_quest_objects.task_title7,
			player_quest_objects.task_description7,
			player_quest_objects.task_title8,
			player_quest_objects.task_description8,
			player_quest_objects.task_title9,
			player_quest_objects.task_description9,
			player_quest_objects.task_title10,
			player_quest_objects.task_description10,
			player_quest_objects.task_title11,
			player_quest_objects.task_description11,
			player_quest_objects.task_title12,
			player_quest_objects.task_description12,
			player_quest_objects.object_id
		)
		VALUES
		(
			p_title(i),
			p_description(i),
			p_creator(i),
			p_total_tasks(i),
			p_difficulty(i),
			p_task_title1(i),
			p_task_description1(i),
			p_task_title2(i),
			p_task_description2(i),
			p_task_title3(i),
			p_task_description3(i),
			p_task_title4(i),
			p_task_description4(i),
			p_task_title5(i),
			p_task_description5(i),
			p_task_title6(i),
			p_task_description6(i),
			p_task_title7(i),
			p_task_description7(i),
			p_task_title8(i),
			p_task_description8(i),
			p_task_title9(i),
			p_task_description9(i),
			p_task_title10(i),
			p_task_description10(i),
			p_task_title11(i),
			p_task_description11(i),
			p_task_title12(i),
			p_task_description12(i),
			p_object_id(i)
		);

	exception
		when dup_val_on_index then
		begin
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'persister.add_player_quest_obj : dup_val_on_index error.');
			END IF;
			for i in 1..p_chunk_size loop
				m_error_index := i;
				UPDATE player_quest_objects Set
					player_quest_objects.title = nvl(p_title(i),player_quest_objects.title),
					player_quest_objects.description = nvl(p_description(i),player_quest_objects.description),
					player_quest_objects.creator = nvl(p_creator(i),player_quest_objects.creator),
					player_quest_objects.total_tasks = nvl(p_total_tasks(i),player_quest_objects.total_tasks),
					player_quest_objects.difficulty = nvl(p_difficulty(i),player_quest_objects.difficulty),
					player_quest_objects.task_title1 = nvl(p_task_title1(i),player_quest_objects.task_title1),
					player_quest_objects.task_description1 = nvl(p_task_description1(i),player_quest_objects.task_description1),
					player_quest_objects.task_title2 = nvl(p_task_title2(i),player_quest_objects.task_title2),
					player_quest_objects.task_description2 = nvl(p_task_description2(i),player_quest_objects.task_description2),
					player_quest_objects.task_title3 = nvl(p_task_title3(i),player_quest_objects.task_title3),
					player_quest_objects.task_description3 = nvl(p_task_description3(i),player_quest_objects.task_description3),
					player_quest_objects.task_title4 = nvl(p_task_title4(i),player_quest_objects.task_title4),
					player_quest_objects.task_description4 = nvl(p_task_description4(i),player_quest_objects.task_description4),
					player_quest_objects.task_title5 = nvl(p_task_title5(i),player_quest_objects.task_title5),
					player_quest_objects.task_description5 = nvl(p_task_description5(i),player_quest_objects.task_description5),
					player_quest_objects.task_title6 = nvl(p_task_title6(i),player_quest_objects.task_title6),
					player_quest_objects.task_description6 = nvl(p_task_description6(i),player_quest_objects.task_description6),
					player_quest_objects.task_title7 = nvl(p_task_title7(i),player_quest_objects.task_title7),
					player_quest_objects.task_description7 = nvl(p_task_description7(i),player_quest_objects.task_description7),
					player_quest_objects.task_title8 = nvl(p_task_title8(i),player_quest_objects.task_title8),
					player_quest_objects.task_description8 = nvl(p_task_description8(i),player_quest_objects.task_description8),
					player_quest_objects.task_title9 = nvl(p_task_title9(i),player_quest_objects.task_title9),
					player_quest_objects.task_description9 = nvl(p_task_description9(i),player_quest_objects.task_description9),
					player_quest_objects.task_title10 = nvl(p_task_title10(i),player_quest_objects.task_title10),
					player_quest_objects.task_description10 = nvl(p_task_description10(i),player_quest_objects.task_description10),
					player_quest_objects.task_title11 = nvl(p_task_title11(i),player_quest_objects.task_title11),
					player_quest_objects.task_description11 = nvl(p_task_description11(i),player_quest_objects.task_description11),
					player_quest_objects.task_title12 = nvl(p_task_title12(i),player_quest_objects.task_title12),
					player_quest_objects.task_description12 = nvl(p_task_description12(i),player_quest_objects.task_description12)
				where
					player_quest_objects.object_id=p_object_id(i);

				if SQL%ROWCOUNT=0 then
					insert into player_quest_objects
					(
					player_quest_objects.title,
					player_quest_objects.description,
					player_quest_objects.creator,
					player_quest_objects.total_tasks,
					player_quest_objects.difficulty,
					player_quest_objects.task_title1,
					player_quest_objects.task_description1,
					player_quest_objects.task_title2,
					player_quest_objects.task_description2,
					player_quest_objects.task_title3,
					player_quest_objects.task_description3,
					player_quest_objects.task_title4,
					player_quest_objects.task_description4,
					player_quest_objects.task_title5,
					player_quest_objects.task_description5,
					player_quest_objects.task_title6,
					player_quest_objects.task_description6,
					player_quest_objects.task_title7,
					player_quest_objects.task_description7,
					player_quest_objects.task_title8,
					player_quest_objects.task_description8,
					player_quest_objects.task_title9,
					player_quest_objects.task_description9,
					player_quest_objects.task_title10,
					player_quest_objects.task_description10,
					player_quest_objects.task_title11,
					player_quest_objects.task_description11,
					player_quest_objects.task_title12,
					player_quest_objects.task_description12,
					player_quest_objects.object_id
					)
					VALUES
					(
					p_title(i),
					p_description(i),
					p_creator(i),
					p_total_tasks(i),
					p_difficulty(i),
					p_task_title1(i),
					p_task_description1(i),
					p_task_title2(i),
					p_task_description2(i),
					p_task_title3(i),
					p_task_description3(i),
					p_task_title4(i),
					p_task_description4(i),
					p_task_title5(i),
					p_task_description5(i),
					p_task_title6(i),
					p_task_description6(i),
					p_task_title7(i),
					p_task_description7(i),
					p_task_title8(i),
					p_task_description8(i),
					p_task_title9(i),
					p_task_description9(i),
					p_task_title10(i),
					p_task_description10(i),
					p_task_title11(i),
					p_task_description11(i),
					p_task_title12(i),
					p_task_description12(i),
					p_object_id(i)
					);
				end if;
			end loop;
		end;
		when others then
		begin
			for i in 1..p_chunk_size loop
			m_error_index := i;
			insert into player_quest_objects
			(
				player_quest_objects.title,
				player_quest_objects.description,
				player_quest_objects.creator,
				player_quest_objects.total_tasks,
				player_quest_objects.difficulty,
				player_quest_objects.task_title1,
				player_quest_objects.task_description1,
				player_quest_objects.task_title2,
				player_quest_objects.task_description2,
				player_quest_objects.task_title3,
				player_quest_objects.task_description3,
				player_quest_objects.task_title4,
				player_quest_objects.task_description4,
				player_quest_objects.task_title5,
				player_quest_objects.task_description5,
				player_quest_objects.task_title6,
				player_quest_objects.task_description6,
				player_quest_objects.task_title7,
				player_quest_objects.task_description7,
				player_quest_objects.task_title8,
				player_quest_objects.task_description8,
				player_quest_objects.task_title9,
				player_quest_objects.task_description9,
				player_quest_objects.task_title10,
				player_quest_objects.task_description10,
				player_quest_objects.task_title11,
				player_quest_objects.task_description11,
				player_quest_objects.task_title12,
				player_quest_objects.task_description12,
				player_quest_objects.object_id
			)
			VALUES
			(
				p_title(i),
				p_description(i),
				p_creator(i),
				p_total_tasks(i),
				p_difficulty(i),
				p_task_title1(i),
				p_task_description1(i),
				p_task_title2(i),
				p_task_description2(i),
				p_task_title3(i),
				p_task_description3(i),
				p_task_title4(i),
				p_task_description4(i),
				p_task_title5(i),
				p_task_description5(i),
				p_task_title6(i),
				p_task_description6(i),
				p_task_title7(i),
				p_task_description7(i),
				p_task_title8(i),
				p_task_description8(i),
				p_task_title9(i),
				p_task_description9(i),
				p_task_title10(i),
				p_task_description10(i),
				p_task_title11(i),
				p_task_description11(i),
				p_task_title12(i),
				p_task_description12(i),
				p_object_id(i)
			);

			end loop;
		exception
			when others then
			begin
				m_enable_db_logging := db_error_logger.getLogLevel();
				IF (m_enable_db_logging > 0) THEN
					db_error_logger.dblogerror(SQLCODE,'persister.add_player_quest_obj : error.');
					IF (m_enable_db_logging > 1) THEN
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','object_id','number',p_object_id(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','title','varchar2',p_title(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','description','varchar2',p_description(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','creator','number',p_creator(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','total_tasks','int',to_char(p_total_tasks(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','difficulty','int',to_char(p_difficulty(m_error_index)));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title1','varchar2',p_task_title1(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description1','varchar2',p_task_description1(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title2','varchar2',p_task_title2(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description2','varchar2',p_task_description2(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title3','varchar2',p_task_title3(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description3','varchar2',p_task_description3(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title4','varchar2',p_task_title4(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description4','varchar2',p_task_description4(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title5','varchar2',p_task_title5(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description5','varchar2',p_task_description5(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title6','varchar2',p_task_title6(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description6','varchar2',p_task_description6(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title7','varchar2',p_task_title7(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description7','varchar2',p_task_description7(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title8','varchar2',p_task_title8(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description8','varchar2',p_task_description8(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title9','varchar2',p_task_title9(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description9','varchar2',p_task_description9(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title10','varchar2',p_task_title10(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description10','varchar2',p_task_description10(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title11','varchar2',p_task_title11(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description11','varchar2',p_task_description11(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_title12','varchar2',p_task_title12(m_error_index));
						db_error_logger.dblogerror_values('persister.add_player_quest_obj','task_description12','varchar2',p_task_description12(m_error_index));
					END IF;
				END IF;
				IF (db_error_logger.reraisecheck('persister','add_player_quest_obj') = 1) THEN
					RAISE;
				END IF;
			end;
		end;
	end;

	procedure remove_player_quest_obj( p_object_id VAOFSTRING, p_chunk_size number )
	as
	begin
		FORALL i IN 1..p_chunk_size
		delete player_quest_objects
		where
			object_id=p_object_id(i);
	end;

end;

/

  GRANT EXECUTE ON "SWG"."PERSISTER" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body PURGE_METHODS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."PURGE_METHODS" IS

  FUNCTION Purge_objects
    (date_in       in objects.deleted_date%type)
  RETURN NUMBER IS
    v_count NUMBER := 0;
  BEGIN
  --open the cursor for the object ids we want to purge.
  --we will use these ids to delete child records from other tables
    FOR x IN (SELECT /*+ INDEX (OBJECTS DELETED_OBJECT_IDX) */ object_id
              FROM objects
              WHERE deleted_date < date_in) LOOP

       IF v_count = 0 THEN
          dbms_output.put_line ('Starting to delete....');
       END IF;

       --delete all children
       DELETE FROM armor nologging WHERE object_id = x.object_id;

       DELETE FROM battlefield_marker_objects nologging WHERE object_id = x.object_id;
       DELETE FROM battlefield_participants nologging WHERE region_object_id = x.object_id;
       DELETE FROM battlefield_participants nologging WHERE character_object_id = x.object_id ;
       DELETE FROM biographies nologging WHERE object_id = x.object_id ;
       DELETE FROM building_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM cell_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM creature_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM experience_points nologging WHERE object_id = x.object_id ;
       DELETE FROM factory_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM guild_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM harvester_installation_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM installation_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM intangible_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM location_lists nologging WHERE object_id = x.object_id ;
       DELETE FROM manf_schematic_attributes nologging WHERE object_id = x.object_id ;
       DELETE FROM manf_schematic_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM manufacture_inst_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM mission_objects nologging WHERE object_id = x.object_id ;

       DELETE FROM object_variables nologging WHERE object_id = x.object_id ;
       DELETE FROM planet_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM player_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM property_lists nologging WHERE object_id = x.object_id ;
       DELETE FROM resource_container_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM scripts nologging WHERE object_id = x.object_id ;
       DELETE FROM static_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM tangible_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM token_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM universe_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM vehicle_objects nologging WHERE object_id = x.object_id ;
       DELETE FROM waypoints nologging WHERE object_id = x.object_id ;
       DELETE FROM weapon_objects nologging WHERE object_id = x.object_id ;
       --delete messages target(object_id)
       DELETE FROM messages nologging WHERE target = x.object_id ;

       v_count := v_count + 1;

       COMMIT;

    END LOOP;

    --delete parent
    DELETE /*+ INDEX (OBJECTS DELETED_OBJECT_IDX) */ FROM objects
    nologging WHERE deleted_date < date_in;

    dbms_output.put_line (v_count||': iterations');

    COMMIT;
    RETURN 0;

    EXCEPTION
      WHEN OTHERS THEN
      ROLLBACK;
      IF v_count = 0 THEN
        dbms_output.put_line ('never deleted');
      END IF;
      dbms_output.put_line (v_count||': iterations');
      RETURN SQLCODE;
  END Purge_objects;
  --
  --
  --
  FUNCTION time_purge
    (date_in          IN VARCHAR2)
  RETURN INTEGER IS
    v_retval NUMBER := 0;
    v_date VARCHAR2(20) := date_in;
    v_time NUMBER := 1;
  BEGIN

    FOR i IN 1..24 LOOP
      dbms_output.put_line(to_char(to_date(v_date, 'dd-mon-yy hh24:mi:ss') + v_time/24, 'DD-MON-YY hh24:mi:ss'));
      v_retval := purge_objects(to_date(v_date, 'dd-mon-yy hh24:mi:ss') + v_time/24);
      EXIT WHEN v_retval <> 0;

      IF v_time = 23 THEN
       v_time := v_time + (59/60);
      ELSE
        v_time := v_time + 1;
      END IF;
    END LOOP;

    RETURN 0;

    EXCEPTION
      WHEN OTHERS THEN
      ROLLBACK;
      dbms_output.put_line('Purge return values: '||v_retval);
      dbms_output.put_line('Time it failed at: '||v_time);
      RETURN SQLCODE;
  END time_purge;

end purge_methods;

/

  GRANT EXECUTE ON "SWG"."PURGE_METHODS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body PURGE_METHODS2
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."PURGE_METHODS2" is
/**********************************************************************/
/*** Purge Objects                                                  ***/
/***                                                                ***/
/*** Deletes objects marked for deletion in object tables and       ***/
/*** then the master objects table based on date value              ***/
/**********************************************************************/

  FUNCTION Purge_objects
    (date_in       in objects.deleted_date%type)
  RETURN PLS_INTEGER
  IS
    v_count PLS_INTEGER := 0;

  Obj_list Obj_list_t;  -- VARRAY object to hold ids to bulk delete for child objects
  Obj_list_index PLS_INTEGER; -- index into VARRAY object

  BEGIN

  Obj_list := Obj_list_t();   -- initialize VARRAY object
  Obj_list.extend(chunk_size); -- allocate VARRAY object memory to chunk size

  -- LOGGING.LOG_STATUS(1,'Starting object deletions.');

  --open the cursor for the object ids we want to purge.
  --we will use these ids to delete records from other tables
    FOR x IN (SELECT /*+ INDEX (OBJECTS DELETED_OBJECT_IDX) */ object_id
              FROM objects
              WHERE deleted_date < date_in) LOOP

       v_count := v_count + 1;
       Obj_list_index := MOD(v_count, chunk_size); -- what obj index for this batch

       If Obj_list_index = 0 then
          Obj_list(chunk_size) := x.object_id; -- make sure we fill last VARRAY element
          Purge_objects_work(Obj_list); -- bulk delete object ids in VARRAY list
          COMMIT;
     --     LOGGING.LOG_STATUS(v_count,'batch purged');
       Else
          Obj_list(Obj_list_index) := x.object_id; -- fill VARRAY with ids
       End If;

    END LOOP;

  -- LOGGING.LOG_STATUS(v_count,'Child object main loop exited.');

    --Now delete remaining partially full object list for objects
    If Obj_list_index != 0 then
        Obj_list.trim(chunk_size - Obj_list_index);
        Purge_objects_work(Obj_list);
        COMMIT;
    --    LOGGING.LOG_STATUS(v_count,'Deleting chunk remainder.');
    End If;

  Obj_list.delete; -- cleanup - delete VARRAY list

--  LOGGING.LOG_STATUS(v_count,'Finished deleting '|| to_char(v_count) ||' references to objects.');

  RETURN 0;

    EXCEPTION
      WHEN OTHERS THEN
      ROLLBACK;

      IF v_count = 0 THEN
        dbms_output.put_line ('never deleted');
     --   LOGGING.LOG_ERROR(SQLCODE, SQLERRM);
      END IF;
      dbms_output.put_line (v_count||': iterations');
    --  LOGGING.LOG_ERROR(SQLCODE, SQLERRM);
      RETURN SQLCODE;
  END Purge_objects;

/**********************************************************************/
/*** Purge Objects Work                                             ***/
/***                                                                ***/
/*** Bulk delete objects marked for deletion in child object tables ***/
/*** given a list of object ids passed in from a VARRAY. Called     ***/
/*** purge objects function.                                        ***/
/**********************************************************************/

  PROCEDURE Purge_objects_work
    (Obj_list IN Obj_list_t) IS

  BEGIN

          --delete all children
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM armor WHERE object_id = Obj_list(i);

          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM battlefield_marker_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM battlefield_participants WHERE region_object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM battlefield_participants WHERE character_object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM biographies WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM building_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM cell_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM creature_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM experience_points WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM factory_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM guild_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM harvester_installation_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM installation_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM intangible_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM location_lists WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM manf_schematic_attributes WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM manf_schematic_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM manufacture_inst_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM mission_objects WHERE object_id = Obj_list(i);

          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM object_variables WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM planet_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM player_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM property_lists WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM resource_container_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM scripts WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM static_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM tangible_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM token_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM universe_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM vehicle_objects WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM waypoints WHERE object_id = Obj_list(i);
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM weapon_objects WHERE object_id = Obj_list(i);
          --delete messages target(object_id)
          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM messages WHERE target = Obj_list(i);

          FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM objects WHERE object_id = Obj_list(i);

  END Purge_objects_work;
  --
  --
  --
  FUNCTION time_purge
    (date_in          IN VARCHAR2)
  RETURN PLS_INTEGER IS
    v_retval PLS_INTEGER := 0;
    v_date VARCHAR2(20) := date_in;
    v_time NUMBER := 1;
  BEGIN

    FOR i IN 1..24 LOOP
      dbms_output.put_line(to_char(to_date(v_date, 'dd-mon-yy hh24:mi:ss') + v_time/24, 'DD-MON-YY hh24:mi:ss'));
      v_retval := purge_objects(to_date(v_date, 'dd-mon-yy hh24:mi:ss') + v_time/24);
      EXIT WHEN v_retval <> 0;

      IF v_time = 23 THEN
       v_time := v_time + (59/60);
      ELSE
        v_time := v_time + 1;
      END IF;
    END LOOP;

    RETURN 0;

    EXCEPTION
      WHEN OTHERS THEN
      ROLLBACK;
      dbms_output.put_line('Purge return values: '||v_retval);
      dbms_output.put_line('Time it failed at: '||v_time);
      RETURN SQLCODE;
  END time_purge;

/**********************************************************************/
/*** Purge Consumables                                              ***/
/***                                                                ***/
/*** Deletes consumable objects marked for deletion in child object ***/
/*** tables and then the master objects table based on date value   ***/
/**********************************************************************/

  FUNCTION Purge_consumables
    (start_date_in       in objects.deleted_date%type,
     end_date_in         in objects.deleted_date%type)
  RETURN PLS_INTEGER
  IS
    v_count PLS_INTEGER := 0;

  Obj_list Obj_list_t;  -- VARRAY object to hold ids to bulk delete for objects
  Obj_list_index PLS_INTEGER; -- index into VARRAY object

  BEGIN

  Obj_list := Obj_list_t();   -- initialize VARRAY object
  Obj_list.extend(chunk_size); -- allocate VARRAY object memory to chunk size

 -- LOGGING.LOG_STATUS(1,'Starting child object deletions for consumables.');

  --open the cursor for the object ids we want to purge.
  --we will use these ids to delete records from other tables
    FOR x IN (SELECT object_id
              FROM objects
              WHERE deleted_date is not NULL
              AND deleted_date BETWEEN start_date_in AND end_date_in
              and object_template_id in (
           300281711,
           352903310,
          1006954225,
             9343642,
            35614291,
           339194814,
          1001781097,
          1632911215,
          1139268412,
          2059421636,
          1349101341,
         -1657672270,
          1931602976,
         -1440714292,
         -1436615854,
         -1614624973,
         -1556205486,
          -679440489,
         -1397391672,
          -541746271,
          -718648728,
          -789429729,
          -786663538,
          -610128810,
          -132487792,
         -1129945606,
          -104858180,
           -82570045)) LOOP

       v_count := v_count + 1;
       Obj_list_index := MOD(v_count, chunk_size); -- what obj index for this batch

       If Obj_list_index = 0 then
          Obj_list(chunk_size) := x.object_id; -- make sure we fill last VARRAY element
          Purge_consumables_work(Obj_list); -- bulk delete object ids in VARRAY list
          COMMIT;
       --   LOGGING.LOG_STATUS(v_count,'batch purged');
       Else
          Obj_list(Obj_list_index) := x.object_id; -- fill VARRAY with ids
       End If;

    END LOOP;

 -- LOGGING.LOG_STATUS(v_count,'Consumables object main loop exited.');

    --Now delete remaining partially full object list for objects
    If Obj_list_index != 0 then
        Obj_list.trim(chunk_size - Obj_list_index);
        Purge_consumables_work(Obj_list);
        COMMIT;
     --   LOGGING.LOG_STATUS(v_count,'Deleting chunk remainder.');
    End If;

    Obj_list.delete; -- cleanup - delete VARRAY list

 -- LOGGING.LOG_STATUS(v_count,'Finished deleting '|| to_char(v_count) ||' consumable objects.');
  RETURN 0;

    EXCEPTION
      WHEN OTHERS THEN
      ROLLBACK;
      IF v_count = 0 THEN
        dbms_output.put_line ('never deleted');
     --   LOGGING.LOG_ERROR(SQLCODE, SQLERRM);
      END IF;
      dbms_output.put_line (v_count||': iterations');
     -- LOGGING.LOG_ERROR(SQLCODE, SQLERRM);
      RETURN SQLCODE;
  END Purge_consumables;

/**********************************************************************/
/*** Purge Consumables Work                                         ***/
/***                                                                ***/
/*** Bulk delete consumable objects marked for deletion in child    ***/
/*** object tables given a list of object ids passed in from a      ***/
/*** VARRAY. Called purge consumables function.                     ***/
/**********************************************************************/

  PROCEDURE Purge_consumables_work
  (Obj_list IN Obj_list_t)
  IS

  BEGIN

        --delete all children
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM armor WHERE object_id = Obj_list(i);

       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM battlefield_marker_objects WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM biographies nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM creature_objects nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM experience_points nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM factory_objects nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM intangible_objects nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM location_lists nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM mission_objects nologging WHERE object_id = Obj_list(i);

       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM object_variables nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM property_lists nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM resource_container_objects nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM scripts nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM tangible_objects nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM token_objects nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM vehicle_objects nologging WHERE object_id = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM weapon_objects nologging WHERE object_id = Obj_list(i);
       --delete messages target(object_id)
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM messages nologging WHERE target = Obj_list(i);
       FORALL i IN Obj_list.First..Obj_list.Last DELETE FROM objects nologging WHERE object_id = Obj_list(i);
  END Purge_consumables_work;


  --
  --
  --
  FUNCTION time_purge_consumables
    (start_date_in       in objects.deleted_date%type,
     end_date_in         in objects.deleted_date%type)
  RETURN PLS_INTEGER IS
    v_retval PLS_INTEGER := 0;
    v_start_date DATE := start_date_in;
    v_end_date DATE := end_date_in;
    v_hours NUMBER := (v_end_date - v_start_date) * 24;
    v_time NUMBER := 1;
  BEGIN
      dbms_output.put_line('Hours between dates: '||v_hours);
    FOR i IN 1..v_hours LOOP
      v_end_date := v_start_date + v_time/24;
      dbms_output.put_line ('Calling proc with Start Date: '||to_char(v_start_date, 'dd-mon-yy hh24:mi:ss')||'-'||'End Date: '||to_char(v_end_date, 'dd-mon-yy hh24:mi:ss'));
      v_retval := purge_consumables(v_start_date, v_end_date);
      v_start_date := v_start_date + v_time/24;

      EXIT WHEN v_retval <> 0;

    END LOOP;
    RETURN 0;

    EXCEPTION
      WHEN OTHERS THEN
      ROLLBACK;
      dbms_output.put_line('Purge return value: '||v_retval);
      RETURN SQLCODE;
  END time_purge_consumables;

end purge_methods2;

/

  GRANT EXECUTE ON "SWG"."PURGE_METHODS2" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body PURGE_PROCESS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."PURGE_PROCESS" 
as
	procedure update_account_list (source_table varchar2) as
	begin
		--Add new status codes
		execute immediate
			'insert into statuses (id, description, do_purge, reviewed) ' ||
			'select distinct status, status_desc, ''N'', ''N'' ' ||
			'from ' || source_table || ' ' ||
			'where not exists (select * from statuses where statuses.id = ' || source_table || '.status)';

		--Add any new accounts.
		execute immediate
			'insert into purge_accounts (station_id,purge_phase) ' ||
			'select user_id, 0 ' ||
			'from ' || source_table || ' ' ||
			'where not exists (select * from purge_accounts where purge_accounts.station_id = ' || source_table ||'.user_id)';

		--Reset purge phase on existing accounts who may have reactivated:
		execute immediate
			'update purge_accounts ' ||
			'set purge_phase = 0, ' ||
			'purge_start_date = null ' ||
			'where purge_phase<>0 ' ||
			'and exists (select * from ' || source_table || ' , statuses ' ||
				'where ' || source_table || '.user_id = purge_accounts.station_id ' ||
				'and ' || source_table || '.status = statuses.id ' ||
				'and statuses.do_purge=''N'')';

		--Start purge process on accounts who have deactivated:
		execute immediate
			'update purge_accounts ' ||
			'set purge_phase = 1, ' ||
			'purge_start_date=(select nvl(max(close_date),sysdate) from ' || source_table ||
			' where ' || source_table || '.user_id = purge_accounts.station_id) ' ||
			'where purge_phase=0 ' ||
			'and exists (select * from ' || source_table || ', statuses ' ||
				'where ' || source_table || '.user_id = purge_accounts.station_id ' ||
				'and ' || source_table || '.status = statuses.id ' ||
				'and statuses.do_purge=''Y'')';
		--TODO:  immediate purge for banned accounts
	end;

	function get_account_for_purge(p_purge_phase number, p_min_age number) return number
	-- Grabs one account from the list to be purged, and sets a lock on it so that no other process
	-- will attempt to purge it.  (Ignores locks from more than 1 day ago, because those probably mean
	-- something in the process failed.)
	as
		result number;
	begin
		select station_id
		into result
		from purge_accounts
		where purge_accounts.purge_phase = p_purge_phase
		and sysdate - nvl(purge_accounts.purge_phase_date, purge_accounts.purge_start_date) > p_min_age
		and (purge_lock is null or sysdate - purge_lock > 1)
		and rownum < 2
		order by purge_accounts.purge_start_date
		for update;

		update purge_accounts
		set purge_lock=sysdate
		where station_id = result;

		return result;
	end;

	procedure set_purge_status(p_station_id number, p_new_phase number)
	as
	begin
		if (p_new_phase = 0) then
		update purge_accounts
		set purge_phase = p_new_phase,
			purge_start_date = null,
			purge_phase_date = null,
		purge_lock = null
		where station_id = p_station_id;
		else
			update purge_accounts
			set purge_phase = p_new_phase,
			purge_phase_date = sysdate,
			purge_lock = null
			where station_id = p_station_id;
		end if;

	end;
end;

/

  GRANT EXECUTE ON "SWG"."PURGE_PROCESS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body SERVERCLOCK
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."SERVERCLOCK" 
as

	function get_last_save_time return number
	as
		result number;
	begin
		select
			last_save_time
		into
			result
		from
			clock;
		return result;
	end;

end;

/

  GRANT EXECUTE ON "SWG"."SERVERCLOCK" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body STATION_PLAYERS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."STATION_PLAYERS" 
as
	procedure update_character(p_clusterName in varchar2 ,p_characterId in networkid, p_characterName in varchar2, p_objectName in varchar2, p_x in number, p_y in number, p_z in number, p_sceneId in varchar2, p_cash_balance in number, p_bank_balance in number, p_objectTemplateName in varchar2, p_stationId in networkid, p_containedBy in networkid, p_createTime in number, p_playedTime in number , p_numLots in number)
	as
	m_enable_db_logging INTEGER := 0;
	begin
		insert into character_profile (cluster_name, character_id, character_name, object_name, x, y, z, scene_id, cash_balance, bank_balance, object_template_name, station_id, contained_by, create_time, played_time, num_lots)
		values (p_clusterName, p_characterId, p_characterName, p_objectName, p_x, p_y, p_z, p_sceneId, p_cash_balance, p_bank_balance, p_objectTemplateName, p_stationId, p_containedBy, util.unix_time_2_oracle_date_PDT(p_createTime), util.unix_time_2_oracle_date_PDT(p_playedTime), p_numLots);



	exception
		when dup_val_on_index then
			begin

			update character_profile set
			character_name = NVL(p_characterName,character_name),
			object_name = NVL(p_objectName, object_name),
			x = NVL(p_x, x),
			y = NVL(p_y, y),
			z = NVL(p_z, z),
			scene_id = NVL(p_sceneId, scene_id),
			cash_balance = NVL(p_cash_balance, cash_balance),
			bank_balance = NVL(p_bank_balance, bank_balance),
			object_template_name = NVL(p_objectTemplateName, object_template_name),
			station_id = NVL(p_stationId, station_id),
			contained_by = NVL(p_containedBy, contained_by),
			create_time = NVL(util.unix_time_2_oracle_date_PDT(p_createTime),  create_time),
			played_time = NVL(util.unix_time_2_oracle_date_PDT(p_playedTime),  played_time),
			num_lots = NVL(p_numLots, num_lots)
			where cluster_name = p_clusterName
			and character_id = p_characterId;

			end;
		when others then
			m_enable_db_logging := db_error_logger.getLogLevel();
			IF (m_enable_db_logging > 0) THEN
				db_error_logger.dblogerror(SQLCODE,'station_players.update_character : error.');
					IF (m_enable_db_logging > 1) THEN
						NULL;
					END IF;
			END IF;
			IF (db_error_logger.reraisecheck('station_players','update_character') = 1) THEN
				RAISE;
			END IF;
	end;
end;

/

  GRANT EXECUTE ON "SWG"."STATION_PLAYERS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body UNDELETE_METHODS
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."UNDELETE_METHODS" is

  FUNCTION restore_object
    (object_id_in     IN objects.object_id%TYPE)
  RETURN NUMBER IS
  BEGIN
    --update an object and its children
    --continue down tree with any object
    --whose contained_by is a valid object id.
    UPDATE objects
    SET deleted = 0,
        deleted_date = NULL
    WHERE object_id = object_id_in;

    COMMIT;
    RETURN 0;

    EXCEPTION
      WHEN OTHERS THEN
      ROLLBACK;
      RETURN SQLCODE;
  END restore_object;

end undelete_methods;

/

  GRANT EXECUTE ON "SWG"."UNDELETE_METHODS" TO PUBLIC;
--------------------------------------------------------
--  DDL for Package Body UTIL
--------------------------------------------------------

  CREATE OR REPLACE PACKAGE BODY "SWG"."UTIL" 
as
	function unix_time_2_oracle_date_PDT(p_unix_time in number) return date
	as
	begin
		return new_time( to_date('01011970','ddmmyyyy') + 1/24/60/60 * p_unix_time, 'GMT', 'PDT' );
	end;

	function unix_time_2_oracle_date_PST(p_unix_time in number) return date
	as
	begin
		return new_time( to_date('01011970','ddmmyyyy') + 1/24/60/60 * p_unix_time, 'GMT', 'PST' );
	end;

	function unix_time_2_oracle_date_CDT(p_unix_time in number) return date
	as
	begin
		return new_time( to_date('01011970','ddmmyyyy') + 1/24/60/60 * p_unix_time, 'GMT', 'CDT' );
	end;

	function unix_time_2_oracle_date_CST(p_unix_time in number) return date
	as
	begin
		return new_time( to_date('01011970','ddmmyyyy') + 1/24/60/60 * p_unix_time, 'GMT', 'CST' );
	end;

	function unix_time_2_oracle_date(p_unix_time in number, p_timezone_offset in number) return date
	as
	begin
		return ((to_date('01011970','ddmmyyyy') + 1/24/60/60 * p_unix_time) + p_timezone_offset/24);
	end;

	function unix_to_oracle_date(p_unix_time in number, p_timezone_offset in number) return date
	as
	begin
		return unix_time_2_oracle_date(p_unix_time, p_timezone_offset);
	end;

end;

/

  GRANT EXECUTE ON "SWG"."UTIL" TO PUBLIC;

exit;
