[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

ORA-01460 : unimplemented or unreasonable conversion requested.

Posted on 2000-01-25
4
Medium Priority
?
996 Views
Last Modified: 2008-02-26
This piece of Pro*C code works correctly on Sun Solaris, Oracle 7.3.4, and wrong on Sun Solaris, Oracle 8.0.4.

/*--------------------------------------------------------------------
                    * FONCTION   : ora_getregio
                    * AUTEUR     :
                    * CREE LE    : 22 Decembre 1999
                    * MODIFIE LE : 23 Decembre 1999
                    * ENTREES    : # idregion : identifiant de la region courante.
                    * SORTIES    : # infosreg : informations sur la region.
                    * RESULTAT   :  0 si traitement OK,
                    *            : -1 si probleme de traitement.
                    * EXTERNE    : -
                    * ACTION     : Recuperation des informations d'une région dans la base Oracle.
                    * NOTES      : -
                    * ATTENTION  : -
                    * REVISION   : -
                    *--------------------------------------------------------------------
                    */
                   int ora_getregio(char *idregion, TYPE_ORA_REG *infosreg)
                   {

                     /**---------------------------------------------------------------**/
                     /** Declarations des variables de travail.                        **/
                     /**---------------------------------------------------------------**/
                     int lg;
                     char typeregi = 'R';

                     EXEC SQL WHENEVER SQLERROR GOTO error_getregio;
                     EXEC SQL WHENEVER NOT FOUND CONTINUE;

                     /**---------------------------------------------------------------**/
                     /** Selection de la region souhaitee.                             **/
                     /**---------------------------------------------------------------**/
                     (void) uti_trace_print("%s: ora_getregio: avant requete ...\n", MODULE);
                     EXEC SQL
                       SELECT codezone, libezone
                         INTO :infosreg
                         FROM REGDEP
                         WHERE typezone=:typeregi AND codezone=:idregion;
                     (void) uti_trace_print("%s: ora_getregio: apres requete ...\n", MODULE);
/**---------------------------------------------------------------**/
                     /** Normalisation des informations sur la region souhaitee.       **/
                     /**---------------------------------------------------------------**/
                     lg = uti_lenutile(infosreg->coderegi, sizeof(infosreg->coderegi));
                     infosreg->coderegi[lg] = 0;
                     lg = uti_lenutile(infosreg->liberegi, sizeof(infosreg->liberegi));
                     infosreg->liberegi[lg] = 0;

                     /**---------------------------------------------------------------**/
                     /** Sortie normale                                                **/
                     /**---------------------------------------------------------------**/
                     return (0);

                     /**---------------------------------------------------------------**/
                     /** Traitement en cas d'erreur.                                   **/
                     /**---------------------------------------------------------------**/
                     error_getregio:
                       ora_sqlerror("ora_getregio: Probleme de recuperation des informations d'une region dans la
                   base Oracle ...");
                       return(-1);
                   }

And here is the result :

                   TRA, 25/01/2000, 08:43:51, ORAFONCS: ora_getregio: avant requete ...
                   ERR, 25/01/2000, 08:43:51, ORAFONCS: ERREUR: ora_getregio: Probleme de recuperation des
                   informations d'une region dans la base Oracle ...
                   ERR, 25/01/2000, 08:43:51, ORAFONCS: ERREUR: ORA-01460: unimplemented or unreasonable
                   conversion requested


Here are my variables :
                   NLS_LANG = FRENCH_FRANCE.WE8ISO8859P1.
                   ORACLE_BASE = /medoc/vol1/oracle
                   ORACLE_HOME = /medoc/vol1/oracle/product/804
                   ORACLE_SID = A
                   ORACLE_TERM = sun5

                   Are these definitions compatible with my piece of code ?

                   Thanks for your answer.

                   Thierry
0
Comment
Question by:tplai
  • 2
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Hauke
ID: 2385531
Could you give us a description of the table REGDEP?
0
 

Author Comment

by:tplai
ID: 2385550
---------------------------------------------------------
-- Table des regions et departements                   --
---------------------------------------------------------
create table regdep (
  typezone varchar2(1),
  codezone varchar2(3),
  libezone varchar2(30),
  coderegi varchar2(2)
)
tablespace annuaire
storage (initial 10k next 10k pctincrease 0);
0
 

Author Comment

by:tplai
ID: 2385640
I have changed my function and it works on Oracle 7.3.4 and 8.0.4, but I don't undestand why !!!

Here is the new code :

int ora_getregio(char *idregion, TYPE_ORA_REG *infosreg)
{

  /**---------------------------------------------------------------**/
  /** Declarations des variables de travail.                        **/
  /**---------------------------------------------------------------**/
  int lg;
  char requete[BUFSIZ];

  EXEC SQL WHENEVER SQLERROR GOTO error_getregio;
  EXEC SQL WHENEVER NOT FOUND CONTINUE;

  /**---------------------------------------------------------------**/
  /** Selection de la region souhaitee.                             **/
  /**---------------------------------------------------------------**/
  (void) sprintf(requete, "SELECT codezone, libezone FROM REGDEP WHERE typezone='R' AND codezone='%s'", idregion);  
  (void) uti_trace_print("%s: requete = %s\n", MODULE, requete);

  /**---------------------------------------------------------------**/
  /** Recuperation des informations sur la region souhaitee.        **/
  /**---------------------------------------------------------------**/
  EXEC SQL PREPARE T FROM :requete;
  EXEC SQL DECLARE cur_infos_reg CURSOR FOR T;
  EXEC SQL OPEN cur_infos_reg;
  EXEC SQL FETCH cur_infos_reg INTO :infosreg;

  /**---------------------------------------------------------------**/
  /** Normalisation des informations sur la region souhaitee.       **/
  /**---------------------------------------------------------------**/
  lg = uti_lenutile(infosreg->coderegi, sizeof(infosreg->coderegi));
  infosreg->coderegi[lg] = 0;
  lg = uti_lenutile(infosreg->liberegi, sizeof(infosreg->liberegi));
  infosreg->liberegi[lg] = 0;

  /**---------------------------------------------------------------**/
  /** Sortie normale                                                **/
  /**---------------------------------------------------------------**/
  return (0);

  /**---------------------------------------------------------------**/
  /** Traitement en cas d'erreur.                                   **/
  /**---------------------------------------------------------------**/
  error_getregio:
    ora_sqlerror("ora_getregio: Probleme de recuperation des informations d'une region dans la base Oracle ...");
    return(-1);
}

0
 
LVL 2

Accepted Solution

by:
Hauke earned 400 total points
ID: 2387796
I think the problem is '.. WHERE typezone=:typeregi ..' and the variable of type char. Try to use 'char typeregi[] = "R";' instead. A varchar2(1) column needs a string variable. A variable of type char is scalar.

For a constant value '.. WHERE typezone='R' ..' is the best choice.

 
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question