plsql

How to read and extract zip entries from java.sql.Blob type zip file without having FileInputStream or filepath as a string java

依然范特西╮ 提交于 2021-02-04 08:33:04
问题 public static void unzipFiles(java.sql.Blob zip) throws Exception{ String paths = ""; byte[] blobAsBytes = zip.getBytes(1, (int) zip.length()); ZipInputStream zis = new ZipInputStream(zip.getBinaryStream(), StandardCharsets.UTF_8); ZipEntry zipEntry = null; while ((zipEntry = zis.getNextEntry()) != null) { paths=zipEntry.getName()+" "; } Connection conn = DriverManager.getConnection("jdbc:default:connection:"); String sql = "INSERT INTO E (FILENAME) VALUES (:paths)"; PreparedStatement pstmt =

Trigger selecting child records, multiplying their values and updating parent record

♀尐吖头ヾ 提交于 2021-01-29 17:24:49
问题 I am a PL/SQL newbie and I'm struggling with a trigger. Description: I have three objects - PRODUCT, CONTAINS, ORDER. One product can have many CONTAINS and one ORDER can have many CONTAINS (basically it used to be Many-to-many relationship between PRODUCT and ORDER). Each Product has a column "value", each CONTAINS has a column "amount" and each ORDER has a column "total". When I add a new PRODUCT to ORDER via creating new CONTAINS, I want to recalculate field "total" on ORDER. Example:

Store result of minus query ( list of varchars) in a variable in Oracle PL/SQL

♀尐吖头ヾ 提交于 2021-01-29 15:42:50
问题 I'm using below minus query to get the extra project_ids present in TABLE_ONE compared to TABLE_TWO select project_id from TABLE_ONE minus select project_id from TABLE_TWO; I want to store result of above query which is list of varchars in a variable since i need to perform below 2 steps : If above query returns any project_ids, send an email which contains these project_ids in mail body insert those extra project_ids in TABLE_TWO to make sure all project_ids present in TABLE_ONE are present

Writing a Version Number Function in PL/SQL

十年热恋 提交于 2021-01-29 13:23:06
问题 I want to write a function that will give me the next version number for a table. The table stores the existing version on each record. For example, I have the cat table cats seqid 1 name Mr Smith version number 1.2b.3.4 How can I write a program that will be able to increment these values based on various conditions? This is my first attempt if v_username is not null then v_new_nbr = substr(v_cur_nbr, 1,7)||to_number(substr(v_cur_nbr, 8,1))+1 should be 1.2b.3.5 回答1: substr(v_cur_nbr, 1,7)|

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

Column value based on maximum of two dates

假如想象 提交于 2021-01-29 12:46:27
问题 I am trying to get the value of a column based on the maximum of two dates. I have tried this, to get the maximum of two dates. SELECT VIN, MAX(CASE WHEN DELIVERY_TYPE = 25 THEN TRANSACTION_DATE END) AS DELIVERY_DATE, MAX(CASE WHEN DELIVERY_TYPE <> 25 THEN TRANSACTION_DATE END) AS TRANSACTION_DATE FROM TABLE WHERE VIN IN ('XYZ') GROUP BY VIN; I get this, which is what I need.But I need the delivery code. VIN DELIVERY_DATE OTHER_DELIVERY DATE XYZ 26-DEC-18 01-MAY-19 How do I get this VIN

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

Oracle: Update from within procedure not working

穿精又带淫゛_ 提交于 2021-01-29 10:20:56
问题 In my Oracle PL/SQL procedure I am trying to update a row like this: UPDATE personal p SET p.surname = surname, p.name = name, p."alter" = alter, p.sex = sex, p.jobcode = jobcode, p.year_wage = month_wage * 12 WHERE p.personalnr = personalnr; COMMIT; I have added these two statements right after the commit to confirm the code is reached and executed with the right arguments (e.g. here I want to change the name): DBMS_OUTPUT.put_line('updated ' || name); DBMS_OUTPUT.put_line('personalnr ' ||

Parse array of string in PLJSON oracle

蓝咒 提交于 2021-01-29 10:00:42
问题 I have to parse a array of string in my JSON with ORACLE dans PLJSON module. I'm able to parse data without array like CLE,X,Y.. But when I want to get COLORS or REGROUPEMENT_COLORS, this return me nothing. There is the code: DECLARE obj json := json(); obj_1 json := json(); arr json_list := json_list(); test varchar2(255); BEGIN obj := json('{ "DASHBOARD": { "userUid": "", "DATA_DASHBOARD": [ { "CLE": "TESTTEST", "X": "", "Y": "", "COL": "", "ROW": "", "CLASSCOLOR": "", "COLORS": ["df","df"]

NetSuite saved search formula to find the difference of two custom columns

梦想的初衷 提交于 2021-01-29 09:20:52
问题 I'm trying to make a saved search to find out which assemblies can be built by determining if all the components are in stock. So I currently have this in one column CASE WHEN {memberitem.quantityavailable} > 1 THEN 1 ELSE 0 END in conjuntion with a sum summary type. I also have a column with "Member Item" selected and a count summary type. How do I make a third column that calculates the difference between these two? (What would I use for the column names essentially) Is this possible?