Forum OpenACS Development: Problems with TCL-CR_API in Oracle

I was proving the new TCL-CR-API in Oracle and had the following problem with the following function

in the file package-procs-oracle.xql

<fullquery name="package_exec_plsql.exec_plsql_function">
      <querytext>

    BEGIN
      :1 := ${package_name}.${function_name}([plsql_utility::generate_attribute_parameter_call \
          -prepend ":" \
          -indent [expr [string length $package_name] + 29] \
          $pieces]
      );
    END;

      </querytext>
</fullquery>

The previous function es called as package_exec_plsql.exec_plsql_func and not like package_exec_plsql.exec_plsql_function,
really single we changed the name to him and I work correctly

The another problem is, when we created the template, in postgres I do not have ningun error, but in Oracle, I obtain the following error

ora9.c:3602:ora_tcl_command: error in `OCIStmtExecute ()': ORA-01400: cannot insert NULL into ("GESDEV"."ACS_OBJECTS"."CREATION_DATE")
ORA-06512: at "GESDEV.ACS_OBJECT", line 68
ORA-06512: at "GESDEV.CONTENT_ITEM", line 154
ORA-06512: at "GESDEV.CONTENT_TEMPLATE", line 44
ORA-06512: at line 4

SQL:

    BEGIN
      :1 := content_template.new(name            => :name,
                                            text            => :text,
                                            parent_id        => :parent_id,
                                            is_live          => :is_live,
                                            template_id      => :template_id,
                                            creation_date    => :creation_date,
                                            creation_user    => :creation_user,
                                            creation_ip      => :creation_ip
      );
    END;


    while executing
"ns_ora exec_plsql_bind nsdb0 {

    BEGIN
      :1 := content_template.new(name            => :name,
                                          ..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_ora $type $db $sql] $args"
    ("oracle" arm line 2)
    invoked from within
"switch $driverkey {
                oracle {
                    return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
                }
      ..."
    invoked from within
"db_exec exec_plsql_bind $db $full_statement_name $sql 2 1 """
    invoked from within
"if { [regexp {:1} $test_sql] } {
                return [db_exec exec_plsql_bind $db $full_statement_name $sql 2 1 ""]
            } else {
          ..."
    ("uplevel" body line 5)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle -dbn $dbn db {
            # Right now, use :1 as the output value if it occurs in the statement,
            # or not otherwise.
    ..."
    (procedure "db_exec_plsql" line 26)
    invoked from within
"db_exec_plsql exec_plsql_func {}"
    (procedure "package_exec_plsql" line 31)
    invoked from within
"package_exec_plsql -var_list [list  [list name $name ]  [list text $text ]  [list parent_id $parent_id ]  [list is_live $is_live ]  [list template_id ..."
    (procedure "content::template::new" line 3)
    invoked from within
"content::template::new -name {evaluation-tasks-default}"
    invoked from within
"set template_id [content::template::new -name {evaluation-tasks-default}]"
    ("uplevel" body line 29)
    invoked from within
"uplevel 1 $transaction_code "
    (procedure "db_transaction" line 1)
    invoked from within

Collapse
Posted by Dave Bauer on
I don't see anywhere in OpenACS 5.1 or HEAD the error you see in the package_exec_plsql procedure. The query name in the Tcl proc and in the XQL files is correct on the latest from HEAD or oacs-5-1 branch.
Collapse
Posted by Dave Bauer on
Strange,

I find that in Postgresql it was not setting the default for creation_date in content_template__new but probably it got set in a nested function call to content_item__new or acs_object__new.

In Oracle content_template.new has the default for creation_date already set to sysdate so if you don't specify a date it should work.

Collapse
Posted by Dave Bauer on
It looks like the Tcl procedure is setting creation date to an empty string and passing that to the function. I changed it to leave creation_date out completely if it is empty.