如何使用正则表达式或任何其他方法在PL / SQL中提取单引号内的字符串

时间:2018-09-11 12:30:20

标签: regex oracle plsql

我需要使用正则表达式或任何可行的方法使字符串在PL / SQL中的单引号内出现。

private function saveData($report, $reestrData, $structure, $elements) {
        $reestrData->save(false);
        $report->save(false);

        foreach ($elements as $element) {
            $element->save(false);
        }

        $structure->id_title_index = $elements['titleIndex']->id_file_index;
        $structure->id_abstract_index = $elements['abstractIndex']->id_file_index;
        $structure->id_technical_specification_index = $elements['technicalSpecificationIndex']->id_file_index;
        $structure->id_contents_index = $elements['contentsIndex']->id_file_index;
        $structure->id_image_list_index = $elements['imageListIndex']->id_file_index;
        $structure->id_table_list_index = $elements['tableListIndex']->id_file_index;
        $structure->id_text_annex_list_index = $elements['textAnnexListIndex']->id_file_index;
        $structure->id_graph_annex_list_index = $elements['graphAnnexListIndex']->id_file_index;
        $structure->id_glossary_index = $elements['glossaryIndex']->id_file_index;
        $structure->id_report_introduction_index = $elements['reportIntroductionIndex']->id_file_index;
        $structure->id_report_main_part_index = $elements['reportMainPartIndex']->id_file_index;
        $structure->id_report_conclusion_index = $elements['reportConclusionIndex']->id_file_index;
        $structure->id_bibliography_index = $elements['bibliographyIndex']->id_file_index;
        $structure->id_metrologicalexpertise_index = $elements['metrologicalExpertiseIndex']->id_file_index;
        $structure->id_patent_research_index = $elements['patentResearchIndex']->id_file_index;
        $structure->id_cost_statement_index = $elements['costStatementIndex']->id_file_index;

        $structure->save(false);
    }

提前谢谢!

1 个答案:

答案 0 :(得分:0)

使用可以使用替换功能。

select replace ('<some text here>',chr(39)) from dual;

示例select replace (q'[this is ' having' mult'iple ' quotes'']',chr(39)), q'[this is ' having' mult'iple ' quotes'']' original_text from dual;

输出将是:

  

这有多个引号

这将删除字符串中的所有单引号。

如果要删除双引号,请使用chr(34)。