{"id":658,"date":"2022-02-01T09:32:27","date_gmt":"2022-02-01T13:32:27","guid":{"rendered":"https:\/\/tecgesco.com\/blog\/?p=658"},"modified":"2022-02-01T09:32:27","modified_gmt":"2022-02-01T13:32:27","slug":"procedure-retorna-somente-numeros-a-partir-de-um-texto","status":"publish","type":"post","link":"https:\/\/tecgesco.com\/blog\/procedure-retorna-somente-numeros-a-partir-de-um-texto\/","title":{"rendered":"Procedure : Retorna somente n\u00fameros a partir de um texto"},"content":{"rendered":"\n<p>Script<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>--##################################################################\n--AUTOR : Rafmattos - http:\/\/www.activedelphi.com.br\/forum\/viewtopic.php?t=55607&sid=3efd77063b033dd9e6ae386e0fa4d1fb\n--DATA : 01\/02\/2022\n--OBS : Ao passar uma String, \u00e9 retornado somente numeros.\n--##################################################################\nCREATE PROCEDURE ZZRETORNASOMENTENUMEROS(Texto VARCHAR(100))\nRETURNS(Retorno VARCHAR(100)) AS\nDECLARE Ch CHAR(1);\nBEGIN\n  Retorno = &#39;&#39;;\n  WHILE (Texto IS NOT NULL AND Texto &lt;&gt; &#39;&#39;) DO\n  BEGIN\n    Ch = SUBSTRING(Texto FROM 1 FOR 1);\n    IF (Ch &gt;= &#39;0&#39; AND Ch &lt;= &#39;9&#39;) THEN\n      Retorno = Retorno || Ch;\n    Texto = SUBSTRING(Texto FROM 2 FOR 100);\n  END\n  SUSPEND;\nEND;<\/code><\/pre><\/div>\n\n\n\n<p>Como usar ? <\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT * FROM ZZRETORNASOMENTENUMEROS(&#39;TEXTO COM NUMEROS 123456&#39;);<\/code><\/pre><\/div>\n\n\n\n<p>Retorno<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"511\" height=\"218\" src=\"https:\/\/tecgesco.com\/blog\/wp-content\/uploads\/2022\/02\/image.png\" alt=\"\" class=\"wp-image-659\" srcset=\"https:\/\/tecgesco.com\/blog\/wp-content\/uploads\/2022\/02\/image.png 511w, https:\/\/tecgesco.com\/blog\/wp-content\/uploads\/2022\/02\/image-300x128.png 300w\" sizes=\"auto, (max-width: 511px) 100vw, 511px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Script Como usar ? Retorno<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-658","post","type-post","status-publish","format-standard","hentry","category-tecnico"],"_links":{"self":[{"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/posts\/658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/comments?post=658"}],"version-history":[{"count":1,"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/posts\/658\/revisions"}],"predecessor-version":[{"id":660,"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/posts\/658\/revisions\/660"}],"wp:attachment":[{"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/media?parent=658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/categories?post=658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tecgesco.com\/blog\/wp-json\/wp\/v2\/tags?post=658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}