postgresql7.2 select logger_variable__new ( :variable_id, :name, :unit, :type, :creation_user, :creation_ip, :package_id ); select logger_variable__del(:variable_id); select vm.variable_id from logger_project_var_map vm, logger_project_pkg_map pm, logger_projects p where vm.primary_p = 't' and vm.project_id = pm.project_id and pm.package_id = :package_id and p.project_id = pm.project_id and p.active_p = 't' limit 1 select variable_id from logger_variables order by variable_id limit 1