plsql

PL/SQL procedure/function to show data from different tables dynamically alongwith the column names in first data row

╄→尐↘猪︶ㄣ 提交于 2021-02-20 02:51:14
问题 I have a requirement like below. There are 70 tables and I have to build 70 queries from those 70 different tables depending on some condition. Let us say the table names are TAB_1,TAB_2,TAB_3.....,TAB_70 .The number of columns and data type of the columns are different in each table. I will get user input and I have to pass that value to an Oracle PL/SQL function or procedure GET_RESULT() and get the output in tabular format(same as we get when we run a query). Also, I have to show the

Showing Trigger DBMS_OUTPUT.PUT_LINE in Oracle Apex

不打扰是莪最后的温柔 提交于 2021-02-19 08:57:05
问题 I have a trigger: CREATE OR REPLACE TRIGGER Med_Allergy_Warning BEFORE INSERT ON Prescription FOR EACH ROW BEGIN IF (Find_ADR(:NEW.Visit_ID, :NEW.Medication_ID) != 'GOOOO') THEN DBMS_OUTPUT.PUT_LINE('Medication ('||:NEW.Medication_ID||') May cause an allergic reaction… You are warned!'); ELSE DBMS_OUTPUT.PUT_LINE('Medication ('||:NEW.Medication_ID||') was prescribed successfully!'); END IF; END;/ That outputs a DBMS_OUTPUT.PUT_LINE whenever a user enters a prescription that may cause allergic

Oracle PLSQL Recurrence Pattern RFC 2445

江枫思渺然 提交于 2021-02-19 08:14:05
问题 I have a requisite on which I need to convert a RFC 2445 Recurrence Pattern to Dates using PLSQL. Example: RRULE = FREQ=DAILY;INTERVAL=5;COUNT=10 From that rule, I need to write a table with the next 10 occurrences of that pattern. Something like the image bellow, considering start date as 1/1/2019 12:00:00 AM : Does Oracle provides any PLSQL Package that allows me to do this? If doesn't, does anybody knows any PLSQL project initiative for this? Ps: this is the same exactly pattern that

Spooling multiple files

馋奶兔 提交于 2021-02-19 06:58:22
问题 I have a report that I need to export to a csv file for n number of vendors. i have a feeling that I will need to run this more than once so I would like to automate it as much as possible. I wrote the sql plus needed to for one vendor, I'm wonder how can script it to run for each vendor. I have the vendor list stored in the table in the db, but knowing I can't put spool in an pl/sql block, I'm wonder how I can loop through each vendor to create their file. 回答1: I've done similar things by

APEX: Download BLOB from temporary table

旧街凉风 提交于 2021-02-19 03:26:50
问题 I'm trying to build a simple viewing application using Oracle APEX 4.1.1. The info to be displayed is in a table on a different database then the database containing the schema the APEX application accesses. This remote table is accessed using a View ( RemoteTableView ) and a Database Link. The View works as expected, including Oracle's disability to Select a LOB column item through a Database Link. In the APEX application I have defined a Procedure ( DownloadFiles ) that is run whenever a

Oracle query logic to identify email addresses across the dwh schemas

百般思念 提交于 2021-02-17 06:46:12
问题 I was performing an activity to identify eMail addresses based on certain pattern (@xyz.de). I initially tried checking the DBA_TAB_COLS [data dictionary] view but this just finds email column names and I manually need to check the big list of tables. Instead of doing that, is there is a more effective way to just fetch the the pattern value @xyz.de ? Database - oracle 11g Query used SET SERVEROUTPUT ON 100000 DECLARE lv_count number(10):=0; l_str varchar2 (1000); lv_col_name varchar2(255) :=

ORA-00904: “Good”: invalid identifier ORA-06512

雨燕双飞 提交于 2021-02-17 05:37:28
问题 1.getting invalid identifier error while updating row_val variable char value 'Good' into the table 2.while inserting number it's working fine but strings its getting errors 3. declare count_temp number; csv_data varchar2(1000); val varchar2(100); row_val varchar2(100); sqlcmd varchar2(3000); col_name varchar2(100); col_data varchar2(100); begin csv_data:='good,son,r,,happy'; col_data:='varchar2(100)'; select regexp_count(csv_data, ',') + 1 into count_temp from dual; dbms_output.put_line

ORA-00904: “Good”: invalid identifier ORA-06512

两盒软妹~` 提交于 2021-02-17 05:37:27
问题 1.getting invalid identifier error while updating row_val variable char value 'Good' into the table 2.while inserting number it's working fine but strings its getting errors 3. declare count_temp number; csv_data varchar2(1000); val varchar2(100); row_val varchar2(100); sqlcmd varchar2(3000); col_name varchar2(100); col_data varchar2(100); begin csv_data:='good,son,r,,happy'; col_data:='varchar2(100)'; select regexp_count(csv_data, ',') + 1 into count_temp from dual; dbms_output.put_line

dynamic table name in cursor

风格不统一 提交于 2021-02-16 20:25:24
问题 I am trying to insert data whose schema is dynamic, as in user enters the schema name. For some reason I get ORA-000942: table doesn't exist even though table is there in the correct schema. Here is the code: declare l_ext_files_names varchar2(4000) := '&1'; l_schema_name varchar2(4000) := '&2'; l_table_name varchar2(4000) := l_schema_name||'.files_tbl'; l_int_files_names varchar2(4000); c_file_name sys_refcursor; begin open c_file_name for 'select file_names from '||l_table_name; loop fetch

Explain SQL query using UML diagram? [closed]

让人想犯罪 __ 提交于 2021-02-16 13:38:29
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 days ago . Improve this question I have to present some complex queries and PL/SQL codes to people who don't know anything about my project. I need to explain how tables are connected, how conditions are affecting the outcome, joins, loops, etc. Is there a way to document this SQL and PL/SQL