Oracle

How to concat rows separated by a space in oracle?

百般思念 提交于 2021-01-29 13:18:55
问题 I am trying to concat/merge rows in a table to one single row. I tried using listagg but due to varchar limitation this doesn't work. create table tmp(word VARCHAR2(4000), lvl NUMBER); insert into tmp2 values('python',1); insert into tmp2 values('java',2); select listagg(word,' ') within group(order by lvl) as listagg_output from tmp; The output should look like python java. 回答1: What will you do with such a long string? Anyway, have a look at this example; if listagg won't work, xmlagg will.

Different Default ordering between ORACLE and PostgreSQL

…衆ロ難τιáo~ 提交于 2021-01-29 13:17:46
问题 I have a simple ORACLE Query which I should rewrite it to be run on postgresql with same output as below Select X,Y FROM table_name order by Y in case of I have only the below data in the table Here you are the difference between PG and oracle in ordering the data Do you have idea why such this difference occurs? 回答1: Different Default ordering There is no such thing as "default ordering" - neither in Oracle nor in Postgres (or in any other relational database). Tables in a relational

Set up Oracle 12c R1 to connect to web service

风流意气都作罢 提交于 2021-01-29 13:09:29
问题 I have set up ACL using DBMS_NETWORK_ACL_ADMIN package. Here it's But when I am trying to connect to the above web service using GET, I am getting error ORA-29273: HTTP request failed ORA-24247: network access denied by access control list (ACL) ORA-06512: at "SYS.UTL_HTTP", line 368 ORA-06512: at "SYS.UTL_HTTP", line 1118 ORA-06512: at "APEX_040200.WWV_FLOW_WEB_SERVICES", line 550 ORA-06512: at "APEX_040200.WWV_FLOW_WEBSERVICES_API", line 197 ORA-06512: at line 7 29273. 00000 - "HTTP request

Alter Regex to validate email Domain on RFC 5322 from Java to Oracle sql

流过昼夜 提交于 2021-01-29 13:00:30
问题 I need to alter the below Regex to validate emails domains in a oracle database, according to RFC 5322, and ensuring that the criteria below are respected as well. Domain rules that must be respected: must start an end with a letter or digit and be between 1 and 63 characters long. may contain uppercase and lowercase Latin letters (A to Z and a to z). may contain digits 0 to 9, provided that top-level domain names are not all-numeric. may contain hyphen -, provided that it is not the first or

duplicate records need to delete oracle db

拜拜、爱过 提交于 2021-01-29 12:39:19
问题 I need to delete the duplicate records, having ID columns unique values and other columns having duplicate values, first need to find frmo table those records and delete. select * FROM HOURLY_REPORT_TABLE where API_DATE = TO_DATE('27-SEP-20','dd-MON-yy') and API_HOUR = 17; ID APPLICATION API_DATE API_HOUR SO APP API ACTUAL_API AVG_RUN TOTAL_TRANS GOOD_TRANS FAIL_TRANS FAIL_PERC COUNTS_TO1 PERC_TO1 COUNTS_TO15 PERC_TO15 COUNTS_OVER15 PERC_OVER15 COUNTS_1TO5 PERC_1TO5 COUNTS_5TO10 PERC_5TO10

Alter Regex to validate email Domain on RFC 5322 from Java to Oracle sql

二次信任 提交于 2021-01-29 12:24:44
问题 I need to alter the below Regex to validate emails domains in a oracle database, according to RFC 5322, and ensuring that the criteria below are respected as well. Domain rules that must be respected: must start an end with a letter or digit and be between 1 and 63 characters long. may contain uppercase and lowercase Latin letters (A to Z and a to z). may contain digits 0 to 9, provided that top-level domain names are not all-numeric. may contain hyphen -, provided that it is not the first or

PLS-00382: expression is of wrong type by executing function and try to put the returntype in a variable

瘦欲@ 提交于 2021-01-29 11:10:07
问题 When I execute the function I get that the expression is of the wrong type but I don't know why. The return type that I use in the function is the same as where I try to put it in after the function is executed. Below you find the record and table type. TYPE department_id_table_type IS TABLE of DEPARTMENTS.DEPARTMENT_ID%TYPE; TYPE managers_rec_type IS RECORD ( employee_id employees.employee_id%TYPE, first_name employees.first_name%TYPE, last_name employees.last_name%TYPE, department_id_table

Import a CSV file into an Oracle External Table

北战南征 提交于 2021-01-29 11:06:09
问题 I have seen various similar questions to this but none of the solutions seem to work for me. I have been given a CSV file produced on a mainframe that I need to load up into Oracle. I decided to try and map it in an Oracle external table and then use this to get it inserted into Oracle. This is my CSV: CONTRACT_NUMBER,PRODUCTCODE,TRANSACTION_NUMBER,EFFECTIVE_DATE,AMENDMENT,TERM,ACTIVE,AGENT_NUMBER,PREMIUM,ICRATE,RCRATE,IC_ALLOW,RC_ALLOW,SPRATE,TRANSACTION_CODE,TRANSACTION_DATE,AGENT_CATEGORY

Oracle query to Exclude weekends, and 6PM to 9PM

独自空忆成欢 提交于 2021-01-29 11:03:34
问题 I am trying to achieve a query that returns the time difference between two dates excluding weekends(Saturday and Sunday) and excluding time (6 pm-9 am). For now, I have a function that is excluding the weekends, But I am unable to exclude time from the query. Can anyone help with this? The article from which I take help is this CREATE OR REPLACE FUNCTION get_bus_minutes_between( p_start_date DATE, p_end_date DATE ) RETURN NUMBER DETERMINISTIC -- ***** Can't hurt IS days_diff NUMBER := 0; end

Oracle apex select list and hide values

*爱你&永不变心* 提交于 2021-01-29 10:38:43
问题 I have scenario that allow the student to choose desire of majors by defining three select list. I have three majors : CS , IT and IS. For example if the student In the first desire he chosen CS from select list then in the second select list the CS major I want it don't appear in the list . For the second select list if he chosen IT then IT don't appear in the third desire where the last select list will contain only IS . is there any idea how can I do this scenario ? Thanks 回答1: One option