oracle11g

Column Row Transpose in Oracle Sql

有些话、适合烂在心里 提交于 2019-12-31 06:52:51
问题 Hi I have a simple query which give this result And I want to modify it as follows. the Name column becomes the column headers and the studentID column becomes the 1st row 回答1: WITH t AS (SELECT 1001 studentid, 'john' NAME FROM dual UNION ALL SELECT 1002, 'kane' FROM dual ) SELECT * FROM ( SELECT studentid, NAME FROM t) pivot (max(studentid) for name in ('john' John, 'kane' Kane)); 来源: https://stackoverflow.com/questions/19107174/column-row-transpose-in-oracle-sql

Column Row Transpose in Oracle Sql

梦想与她 提交于 2019-12-31 06:51:48
问题 Hi I have a simple query which give this result And I want to modify it as follows. the Name column becomes the column headers and the studentID column becomes the 1st row 回答1: WITH t AS (SELECT 1001 studentid, 'john' NAME FROM dual UNION ALL SELECT 1002, 'kane' FROM dual ) SELECT * FROM ( SELECT studentid, NAME FROM t) pivot (max(studentid) for name in ('john' John, 'kane' Kane)); 来源: https://stackoverflow.com/questions/19107174/column-row-transpose-in-oracle-sql

Search Inside Table Type of Records

柔情痞子 提交于 2019-12-31 06:18:43
问题 I have the below types CREATE OR REPLACE TYPE "CLONE_PRODUCT_CHAR_RECORD" IS OBJECT ( CharacteristicID NUMBER, NewValue VARCHAR2(200 Char), NewValueName VARCHAR2(200 Char) ); CREATE OR REPLACE TYPE "CLONE_PRODUCT_CHAR_TABLE" IS TABLE OF CLONE_PRODUCT_CHAR_RECORD; and the below Procedure DECLARE characteristic CLONE_PRODUCT_CHAR_TABLE:=CLONE_PRODUCT_CHAR_TABLE( CLONE_PRODUCT_CHAR_RECORD(2,'ZIKA','ZIKA'), CLONE_PRODUCT_CHAR_RECORD(3,'MIGO','MIGO'), CLONE_PRODUCT_CHAR_RECORD(4,'ZAG','ZAG') );

Calling PLSQL stored proc from Grails service

南楼画角 提交于 2019-12-31 05:18:38
问题 Need a little help with the closure part of this, and maybe a bit more. I'm trying to call a stored procedure in Oracle 11g from my Grails service. So far: import java.sql.* import groovy.sql.Sql import oracle.jdbc.driver.OracleTypes class DummyService { def dataSource def serviceMethod() { } def listPeople(){ Sql sql = new groovy.sql.Sql(dataSource) def resultList = [] sql.call("BEGIN mypackage.p_get_people(?); END;", [Sql.resultSet(OracleTypes.CURSOR)]) {cursorResults -> if(cursorResults

Show data from table even if there is no data!! Oracle

拥有回忆 提交于 2019-12-31 05:09:53
问题 I have a query which shows count of messages received based on dates. For Eg: 1 | 1-May-2012 3 | 3-May-2012 4 | 6-May-2012 7 | 7-May-2012 9 | 9-May-2012 5 | 10-May-2012 1 | 12-May-2012 As you can see on some dates there are no messages received. What I want is it should show all the dates and if there are no messages received it should show 0 like this 1 | 1-May-2012 0 | 2-May-2012 3 | 3-May-2012 0 | 4-May-2012 0 | 5-May-2012 4 | 6-May-2012 7 | 7-May-2012 0 | 8-May-2012 9 | 9-May-2012 5 | 10

Oracle - Problem creating trigger that updates another table

ぐ巨炮叔叔 提交于 2019-12-31 02:07:07
问题 I've read the Oracle docs on creating triggers and am doing things exactly how it shows, however this just isn't working. My goal is to update the TPM_PROJECT table with the minimum STARTDATE appearing in the TPM_TRAININGPLAN table. Thus, every time someone updates the STARTDATE column in TPM_TRAININGPLAN, I want to update teh TPM_PROJECT table. Here's what I'm trying: CREATE TRIGGER Trigger_UpdateTrainingDelivery AFTER DELETE OR INSERT OR UPDATE OF STARTDATE ON TPM_TRAININGPLAN FOR EACH ROW

ORA-28860: Fatal SSL error when using UTL_HTTP?

a 夏天 提交于 2019-12-31 01:48:33
问题 We are using Oracle 11g (11.2.0.3.0) and we are receiving the following error when executing a UTL_HTTP call: EXCEPTION: ORA-28860: Fatal SSL error EXCEPTION: ORA-06512: at "SYS.UTL_HTTP", line 1128 ORA-06512: at line 23 EXCEPTION: ORA-28860: Fatal SSL error This is the code we are using: DECLARE url_chr VARCHAR2(500); user_id_chr VARCHAR2(100); password_chr VARCHAR2(20); wallet_path_chr VARCHAR2(500); wallet_pass_chr VARCHAR2(20); l_http_request UTL_HTTP.REQ; l_http_response UTL_HTTP.RESP; l

Return sys_refcursor of the oracle to c#

我只是一个虾纸丫 提交于 2019-12-30 13:38:33
问题 C#: public DataSet ListaClientes() { DataSet ds = new DataSet(); try { System.Data.OracleClient.OracleConnection conexion = Conexion.GetConnection(); if (conexion.State == System.Data.ConnectionState.Open) { System.Data.OracleClient.OracleCommand cmd = new System.Data.OracleClient.OracleCommand(); cmd.Connection = conexion; cmd.CommandText = "ListadoClientes"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("resul", OracleDbType.RefCursor).Direction = ParameterDirection

Oracle: Read-only access to the schema for another user?

六眼飞鱼酱① 提交于 2019-12-30 11:27:07
问题 I have a schema and a user with the same name: products . For development I would like to use it in a read-only mode from a java application. Therefore, I created a new user for the read-only application. CREATE USER PRODUCTS_READONLY IDENTIFIED BY PRODUCTS_READONLY; GRANT CREATE SESSION to PRODUCTS_READONLY; BEGIN FOR tab IN (SELECT table_name FROM all_tables WHERE owner = 'PRODUCTS') LOOP EXECUTE IMMEDIATE 'GRANT SELECT ON PRODUCTS.'||tab.table_name||' TO PRODUCTS_READONLY'; END LOOP; END;

How to sent email in Oracle PL/SQL package to multiple receivers?

喜夏-厌秋 提交于 2019-12-30 11:11:27
问题 How to sent email in Oracle PL/SQL package to multiple receivers? I have below pl/sql procedure within an oracle package, it works only for one receiver. I need to improve it functional to let it can send email to multiple receivers at same time like "To: David Festool; Peter Makita; John Dewalt". Any body can help me out will be great appreciate! Please provide me modified code. procedure email(p_recip in varchar2, p_subject in varchar2, p_message in varchar2) is c utl_smtp.connection; msg