{"id":14546,"date":"2023-03-29T13:52:44","date_gmt":"2023-03-29T19:52:44","guid":{"rendered":"http:\/\/201.237.206.56\/Sitios\/ugit.siua.ac.cr\/?p=14546"},"modified":"2023-03-29T14:10:44","modified_gmt":"2023-03-29T20:10:44","slug":"sigesa-renombrar-tabla","status":"publish","type":"post","link":"https:\/\/sada.services\/?p=14546","title":{"rendered":"SIGESA:  Renombrar Tabla"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">En Base de Datos<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Si se requiere modificar el nombre de una tabla<\/li>\n\n\n\n<li>Modificar el nombre de la tabla por ejemplo:  ESTADO_EVALUACION_OPE A ESTADO_EVALUACION_POA<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE \"PPI\".\"ESTADO_EVALUACION_OPE\" RENAME TO ESTADO_EVALUACION_POA;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Y luego debemos modificar el id de la tabla<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE \"PPI\".\"ESTADO_EVALUACION_POA\" RENAME COLUMN ID_ESTADO_EVALUACION_OPE TO ID_ESTADO_EVALUACION_POA;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ahora debemos eliminar el sinomimo de la tabla<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>DROP PUBLIC SYNONYM ESTADO_EVALUACION_OPE;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Y as\u00ed podemos determinar si existe una secuencia para la tabla<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT SQ_ESTADO_EVALUACION_OPE.NEXTVAL FROM DUAL;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ahora a nivel de BD no existe una relaci\u00f3n de la secuencia con tabla por tanto para renombrar la secuencia lo m\u00e1s f\u00e1cil es eliminar la secuencia existente y crear una nueva<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>DROP SEQUENCE \"PPI\".\"SQ_ESTADO_EVALUACION_OPE\";<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Y eliminamos el sinonimo de la secuencia<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>DROP PUBLIC SYNONYM SQ_ESTADO_EVALUACION_OPE;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Por tanto ahora creamos una nueva secuencia<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE SEQUENCE PPI.SQ_ESTADO_EVALUACION_POA START WITH 1 INCREMENT BY 1 MINVALUE 1 NOCACHE  NOCYCLE  NOORDER;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Creamos los sinonimos de la secuencia y tabla<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE PUBLIC SYNONYM ESTADO_EVALUACION_POA FOR \"PPI\".\"ESTADO_EVALUACION_POA\";\nCREATE PUBLIC SYNONYM SQ_ESTADO_EVALUACION_POA FOR PPI.SQ_ESTADO_EVALUACION_POA;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Y volvemos aplicar los Grants de la tabla y sinonimo<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT DELETE, INSERT, UPDATE, SELECT, REFERENCES ON \"PPI\".\"ESTADO_EVALUACION_POA\" TO \"WWW_SIGESA\";\nGRANT SELECT, ALTER ON PPI.SQ_ESTADO_EVALUACION_POA TO WWW_SIGESA;\nGRANT SELECT ON \"PPI\".\"ESTADO_EVALUACION_POA\" TO \"ANALISTA\", \"ANALISTA_SIGESA\";<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">En C\u00f3digo SIGESA<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ahora debemos modificar a nivel de c\u00f3digo para que soporte el cambio realizado<\/li>\n\n\n\n<li>Empezamos modificando los script de creaci\u00f3n de la tabla y i18N<\/li>\n\n\n\n<li>Renombramos el archivo \u00abEstadoEvaluacionOpeCreate.sql\u00bb x \u00abEstadoEvaluacionPOACreate.sql\u00bb<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"355\" height=\"215\" src=\"\/wp-content\/uploads\/2023\/03\/Seleccion_007-1.png\" alt=\"\" class=\"wp-image-14550\" srcset=\"https:\/\/sada.services\/wp-content\/uploads\/2023\/03\/Seleccion_007-1.png 355w, https:\/\/sada.services\/wp-content\/uploads\/2023\/03\/Seleccion_007-1-300x182.png 300w\" sizes=\"(max-width: 355px) 100vw, 355px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Archivo Actual<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>--------------------------------------------------------\n-- Archivo creado  -   Ing. Greivin Barrantes\n--------------------------------------------------------\n--------------------------------------------------------\n--  DDL for Table ESTADO_EVALUACION_OPE     29\/10\/2021\n--------------------------------------------------------\n\n-- TABLE\n\nCREATE TABLE PPI.ESTADO_EVALUACION_OPE\n  (\n    ID_ESTADO_EVALUACION_OPE NUMBER (19) NOT NULL ,\n    NOMBRE VARCHAR2(255) NOT NULL ,\n    ACTIVO  NUMBER (1) NOT NULL ,\n    FECHA_CREACION      DATE NOT NULL ,\n    USUARIO_CREACION NUMBER (19) NOT NULL ,\n    FECHA_MODIFICACION DATE NOT NULL ,\n    USUARIO_MODIFICACION NUMBER (19) NOT NULL ,\n    CAMPO_CONFIGURABLE NUMBER (19) ,\n    VERSION            NUMBER (19)\n  )\n  LOGGING ;\n\n-- Sinonimo de tabla\nCREATE PUBLIC SYNONYM ESTADO_EVALUACION_OPE for PPI.ESTADO_EVALUACION_OPE;\n\n-- Secuencia de tabla\nCREATE SEQUENCE PPI.SQ_ESTADO_EVALUACION_OPE\nSTART WITH 1\nINCREMENT BY 1\nMINVALUE 1\nNOCACHE \nNOCYCLE \nNOORDER;\n\n-- Sinonimo de secuencia de tabla\nCREATE PUBLIC SYNONYM SQ_ESTADO_EVALUACION_OPE for PPI.SQ_ESTADO_EVALUACION_OPE;\n\n\n--INDEX\n\nCREATE UNIQUE INDEX IDX_ESTADO_EVALUACION_OPE ON PPI.ESTADO_EVALUACION_OPE\n  (\n    ID_ESTADO_EVALUACION_OPE ASC\n  )\n  LOGGING ;\n\n\n--GRANT\nGRANT SELECT, ALTER ON \"PPI\".\"SQ_ESTADO_EVALUACION_OPE\" TO \"WWW_SIGESA\";\nGRANT DELETE, INSERT, UPDATE, SELECT, REFERENCES on \"PPI\".\"ESTADO_EVALUACION_OPE\" to \"WWW_SIGESA\";\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>En Base de Datos En C\u00f3digo SIGESA<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[443],"tags":[495,444],"class_list":["post-14546","post","type-post","status-publish","format-standard","hentry","category-sigesa","tag-renombrar-tabla","tag-sigesa"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/posts\/14546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sada.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14546"}],"version-history":[{"count":5,"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/posts\/14546\/revisions"}],"predecessor-version":[{"id":14548,"href":"https:\/\/sada.services\/index.php?rest_route=\/wp\/v2\/posts\/14546\/revisions\/14548"}],"wp:attachment":[{"href":"https:\/\/sada.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sada.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sada.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}