Block with a SQL
Hi Gurus,
I ahve a table named x. In that I have a column called feed_id. I need to construct a block which has the resultset as the below query.
select * from x where feed_id=(select max(feed_id) from x where pk=x.pk group by pk);
Can I use the Data block Wizard to accomplish this?
Is there any other way to do this?
Thanks,
Yes, you can use a From Clause Query. The easiest way is to use the data block wizard to build a block on the x table and then change the source and the advanced DML properties later.
Your query might not be as efficient as it could be. The following query is similar to yours, it gets all the employees whose deptno is the highest in the table, but it only selects from the table once. Rearranging your query along these lines might improve performance.
SELECT empno, ename, job, mgr, hiredate, sal, comm, deptno
FROM(
SELECT e.*, Dense_Rank() over(ORDER BY deptno DESC) dr
FROM emp e
WHERE dr = 1On my database that has a cost of 4 whereas the following has a cost of 6
SELECT * FROM emp
WHERE deptno = (SELECT Max(deptno) FROM emp);
Similar Messages
-
Cell Offload will Happen for pl/sql Block with variables
Hello Experts,
i am working on procedures on exadata now. i was confused with cell offload in exadata. somehow offload is not happening when i ran the sql statement in in pl/sql block with variables.
here are my findings.
when i ran insert into from select with values at toad, my query response time is very good. the total process is completed in less than a minute.
i checked offload is happening.
same sql statement is placed in plsql block with variable, procedure is taking lot of time and it is not completing. this case offload is not happening.
is it true, if i use variables in pl/sql block will not use cell offload and smart scan?
if yes, what is the work around.
Thanks
#! PavanHello Marc,
Thanks for quick response.
when i ran the query with literals in toad session i am getting response.
when i run it with pl/sql block , block is not completing at all.
here is the plsql block:
My Apologies for sending big code,with out proper format.
DECLARE
P_BUSINESS_DATE DATE;
P_BATCH_ID NUMBER;
UTC_OFFSET NUMBER;
BEGIN
P_BUSINESS_DATE := to_date('02/01/2012', 'MM/DD/YYYY');
P_BATCH_ID := 1;
UTC_OFFSET := 0;
INSERT /*+ APPEND */ INTO UPL_CLIENT_tbl
( reportdate,
LastName,
FirstName,
MiddleInitial,
AccountNumber,
Address,
City,
State,
Zip,
HomePhone,
WorkPhone,
BirthDate,
Age,
Sex,
NumberOfChildren,
Occupation,
LeadSource,
Consultant,
ProgramDirector,
CallTaker,
LeadDate,
FirstVisitDate,
LastVisitDate,
BillType,
ClientType,
PreviousClientType,
AppointmentDate,
DoctorLetterRequired,
OneYearPermStabilizationDate,
UnlimitedPermStabilizationDate,
MaritalStatus,
ReferrerName,
ReferrerCentreID,
CentreID,
PaymentDateOne,
PaymentAmountOne,
PaymentDateTwo,
PaymentAmountTwo,
PaymentDateThree,
PaymentAmountThree,
PaymentDateFour,
PaymentAmountFour,
LibraryPurchased,
BalanceDue,
FoodNSFBalance,
ProductNSFBalance,
ProgramNSFBalance,
StartWeight,
CurrentWeight,
GoalWeight,
Height,
DateGoalWeightAchieved,
DateSuccessPlusPurchased,
ReturnToActiveDate,
VersionNumber,
HalfWayDate,
LastLSCDate,
LastUpdatedDate,
VitaminWaiverSigned,
LastSupplementPurchaseDate,
LastSupplementCodePurchased,
LastTotalSupplementSupplyCycle,
LastAddtlSupplPurchaseDate,
LastAddtlSupplCodePurchased,
LastAddtlSupplSupplyCycle,
DiabetesClient,
DietControlled,
TakingOralMed,
TakingInsulin,
EmailId,
CTADate,
RWLDate,
Address2)
(SELECT /*+ full(S_CONTACT) full(REFERRER) full(Consultant) full(ProgramDirector) full(CallTaker) full(S_CONTACT_X) full(a) full(a2) full (a3) */ distinct p_business_date reportdate,
SUBSTR(S_CONTACT.LAST_NAME,1,25) AS LastName,
SUBSTR(S_CONTACT.FST_NAME,1,25) AS FirstName,
SUBSTR(S_CONTACT.MID_NAME,1,1) AS MiddleInitial,
S_CONTACT.X_JC_ACNT_NUM + 900000000 AS AccountNumber,
SUBSTR(S_ADDR_PER.ADDR,1,40) AS ADDRESS,
SUBSTR(S_ADDR_PER.CITY,1,20) AS City,
S_ADDR_PER.STATE AS State,
SUBSTR(S_ADDR_PER.ZIPCODE,1,15) AS Zip,
SUBSTR(REPLACE(S_CONTACT.HOME_PH_NUM,'-',''),1,10) AS HomePhone,
SUBSTR(REPLACE(S_CONTACT.WORK_PH_NUM,'-',''),1,10) AS WorkPhone,
S_CONTACT.BIRTH_DT AS BirthDate,
CASE WHEN FLOOR((p_business_date - S_CONTACT.BIRTH_DT)/360) < 0 THEN NULL ELSE FLOOR((p_business_date - S_CONTACT.BIRTH_DT)/360) END AS AGE,
S_CONTACT.SEX_MF AS SEX,
NULL AS NumberOfChildren,
S_CONTACT_X.ATTRIB_34 AS OCCUPATION,
CASE WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Othe' THEN 'Othr'
WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Inte' THEN 'Intr'
WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Prin' THEN 'News'
WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Gues' THEN 'Gst'
ELSE SUBSTR(S_CONTACT_X.ATTRIB_37,1,4) END AS LeadSource,
SUBSTR(Consultant.EMP_NUM,1,10) AS CONSULTANT,
ProgramDirector.EMP_NUM AS ProgramDirector,
CallTaker.EMP_NUM CallTaker,
S_CONTACT.X_LEAD_DT AS LeadDate,
LEAST(nvl(S_CONTACT.X_LAST_CONSULTATION_DATE,O.FirstPurchaseDate ), nvl(O.FirstPurchaseDate,S_CONTACT.X_LAST_CONSULTATION_DATE+1) ) AS FirstVisitDate, --X_LAST_CONSULTATION_DATE stores the performed date or the legacy client firstvisitdate
GREATEST(nvl(S_CONTACT_XM.X_CONSULTATION_DT ,S_CONTACT_X.ATTRIB_29), nvl(S_CONTACT_X.ATTRIB_29, S_CONTACT_XM.X_CONSULTATION_DT-1) ) AS LastVisitDate,
CASE WHEN S_CONTACT.X_INSTALLMENT_BALANCE > 0 THEN 'B' ELSE NULL END AS BillType,
ct.current_client_type ClientType,
SUBSTR(ct.saved_client_type,1,1) PreviousClientType,
S_CONTACT.LAST_CREDIT_DT AS AppointmentDate,
CASE WHEN a.X_DR_LETTER_STATUS IS NOT NULL THEN 'Y' ELSE 'N' END AS DoctorLetterRequired,
NULL AS OneYearPermStabilizationDate,
DECODE(S_PROD_INT.X_PROGRAM_CLASSIFICATION,'Premium',a.START_DT ,NULL) AS UnlimitedPermStabilizationDate,
SUBSTR(S_CONTACT.MARITAL_STAT_CD,1,1) AS MaritalStatus,
SUBSTR(REFERRER.FST_NAME ||' '|| REFERRER.LAST_NAME,1,34) AS ReferrerName,
ORGEXT_REF.LOC AS ReferrerCentreID,
S_ORG_EXT.LOC AS CentreID,
NULL AS PaymentDateOne,
NULL AS PaymentAmountOne,
NULL AS PaymentDateTwo,
NULL AS PaymentAmountTwo,
NULL AS PaymentDateThree,
NULL AS PaymentAmountThree,
NULL AS PaymentDateFour,
NULL AS PaymentAmountFour,
NULL AS LibraryPurchased,
nvl(S_CONTACT.X_INSTALLMENT_BALANCE,0) + nvl(S_CONTACT.X_PREPAID_BALANCE,0) AS BalanceDue, -- Changed operation from (-) prepaid to (+) prepaid since the sign was flipped in OLTP.
NULL AS FoodNSFBalance,
NULL AS ProductNSFBalance,
NULL AS ProgramNSFBalance,
a2.X_START_WEIGHT AS StartWeight,
a2.X_CURRENT_WEIGHT AS CurrentWeight,
a2.X_GOAL_WEIGHT AS GoalWeight,
a3.X_HEIGHT AS Height,
a2.X_FAXSENT_DATETIME DateGoalWeightAchieved,
DECODE(S_PROD_INT.X_PROGRAM_CLASSIFICATION,'Premium',a.START_DT,NULL) AS DateSuccessPlusPurchased,
CASE WHEN A2.ARCHIVE_FLG = 'N' THEN a2.START_DT ELSE NULL END AS ReturnToActiveDate,
600 VersionNumber,
a2.X_FAXRECV_DATETIME AS HalfWayDate,
NULL AS LastLSCDate,
TRUNC(S_CONTACT.LAST_UPD-UTC_OFFSET/24) AS LastUpdatedDate,
NULL AS VitaminWaiverSigned,
LastSupplementPurchaseDate,
LastSupplementCodePurchased,
LastTotalSupplementSupplyCycle,
LastAddtlSupplPurchaseDate,
LastAddtlSupplCodePurchased,
LastAddtlSupplSupplyCycle,
CASE WHEN (a.X_DIABETES_NO_MEDS_FLG='Y' OR a.X_DIABETES_ORAL_MEDS_FLG = 'Y' OR a.X_DIABETES_ON_INSULIN_FLG = 'Y') THEN 'Y' ELSE 'N' END AS DiabetesClient,
DECODE(a.X_DIABETES_NO_MEDS_FLG,'Y','Y','N') AS DietControlled,
a.X_DIABETES_ORAL_MEDS_FLG AS TakingOralMed,
a.X_DIABETES_ON_INSULIN_FLG AS TakingInsulin,
S_CONTACT.EMAIL_ADDR AS EmailId,
NULL CTADATE,
NULL RWLDATE,
SUBSTR(S_ADDR_PER.ADDR_LINE_2,1,40) AS Address2
FROM S_CONTACT,
S_CONTACT REFERRER,
S_CONTACT Consultant,
S_CONTACT ProgramDirector,
S_CONTACT CallTaker,
S_CONTACT_X,
(SELECT /*+ parallel full(S_CONTACT_XM) */ PAR_ROW_ID, attrib_05, MAX(X_CONSULTATION_DT) AS X_CONSULTATION_DT FROM S_CONTACT_XM
WHERE (S_CONTACT_XM.last_upd_by < '1-14WD'
or S_CONTACT_XM.last_upd_by > '1-14WD')
AND S_CONTACT_XM.ATTRIB_05 IN (SELECT row_id FROM S_ORG_EXT WHERE S_ORG_EXT.ACCNT_TYPE_CD IN ('Corporate Centre','Franchise Centre')) LOC IN (SELECT centreid FROM UPL_LIVE_CENTRES WHERE LIVE = 'Y' AND BATCHID = p_batch_id)) where S_ORG_EXT.ACCNT_TYPE_CD IN ('Corporate Centre','Franchise Centre')) --
GROUP BY PAR_ROW_ID, attrib_05) S_CONTACT_XM,
(SELECT CONTACT_ID, ACCNT_ID,
MAX(LastSupplementPurchaseDate) AS LastSupplementPurchaseDate,
MAX(LastSupplementCodePurchased) AS LastSupplementCodePurchased,
MAX(LastTotalSupplementSupplyCycle) AS LastTotalSupplementSupplyCycle,
MAX(LastAddtlSupplPurchaseDate) AS LastAddtlSupplPurchaseDate,
MAX(LastAddtlSupplCodePurchased) AS LastAddtlSupplCodePurchased,
MAX(LastAddtlSupplSupplyCycle) AS LastAddtlSupplSupplyCycle,
MIN(FirstPurchaseDate) AS FirstPurchaseDate,
MAX(LastPurchaseDate) AS LastPurchaseDate
FROM (
SELECT /*+ parallel full(S_ORDER) full(S_ORDER_XM) */ S_ORDER.CONTACT_ID AS CONTACT_ID,S_ORDER.ACCNT_ID,
NULL AS LastSupplementPurchaseDate,
NULL AS LastSupplementCodePurchased,
NULL AS LastTotalSupplementSupplyCycle,
NULL AS LastAddtlSupplPurchaseDate,
NULL AS LastAddtlSupplCodePurchased,
NULL AS LastAddtlSupplSupplyCycle,
(S_ORDER_XM.X_BUSINESS_DATE) FirstPurchaseDate,
(S_ORDER_XM.X_BUSINESS_DATE) LastPurchaseDate
FROM S_ORDER,S_ORDER_XM
WHERE S_ORDER.ROW_ID = S_ORDER_XM.PAR_ROW_ID
AND S_ORDER.STATUS_CD IN ('Complete', 'Submitted', 'Ready')
AND TRUNC(S_ORDER_XM.X_BUSINESS_DATE - UTC_OFFSET/24) <= (p_business_date)
--GROUP BY S_ORDER.CONTACT_ID
UNION ALL
SELECT /*+ parallel full(S_ORDER) full (S_ORDER_ITEM) */ S_ORDER.CONTACT_ID AS CONTACT_ID,S_ORDER.ACCNT_ID,
(CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN S_ORDER.CREATED ELSE NULL END) AS LastSupplementPurchaseDate,
(CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN 931 ELSE NULL END) AS LastSupplementCodePurchased,
(CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN 7 ELSE NULL END) AS LastTotalSupplementSupplyCycle,
(CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN S_ORDER.CREATED ELSE NULL END) AS LastAddtlSupplPurchaseDate,
(CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN 920 ELSE NULL END) AS LastAddtlSupplCodePurchased,
(CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN 28 ELSE NULL END) AS LastAddtlSupplSupplyCycle,
NULL FirstPurchaseDate,
NULL LastPurchaseDate
FROM S_ORDER,S_ORDER_ITEM, S_PROD_INT
WHERE S_ORDER_ITEM.PROD_ID = S_PROD_INT.ROW_ID
AND S_ORDER.ROW_ID = S_ORDER_ITEM.ORDER_ID
AND S_ORDER_ITEM.qty_req <> 0
AND s_order.created_by <> '1-14WD'
AND S_ORDER_ITEM.PAR_ORDER_ITEM_ID is null
AND (S_ORDER_ITEM.PAR_ORDER_ITEM_ID is null
OR EXISTS (select 1 from S_ORDER_ITEM i2,s_prod_int p
where i2.row_id = S_ORDER_ITEM.PAR_ORDER_ITEM_ID
and SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) IN ('931','920')
and i2.prod_id = p.row_id
AND S_ORDER.status_cd in ('Complete', 'Submitted', 'Ready')
and SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) IN ('931','920')
GROUP BY CONTACT_ID,ACCNT_ID) O,
S_CONTACT_TNTX,
S_ORG_EXT,
S_ORG_EXT ORGEXT_REF,
S_ADDR_PER,
S_ASSET a,
S_PROD_INT,
S_ASSET a2,
S_ASSET a3,
UPL_CLIENT_TYPES ct,
(select /*+ parallel */ o.contact_id, o.accnt_id
from S_ORDER o, S_ORDER_XM oxm
where o.row_id = oxm.par_row_id
and trunc(oxm.X_BUSINESS_DATE - (UTC_OFFSET/24)) = trunc(p_business_date)
group by o.contact_id, o.accnt_id) oxm2
WHERE S_CONTACT.ROW_ID = S_CONTACT_X.PAR_ROW_ID
AND S_CONTACT_X.ROW_ID = S_CONTACT_XM.PAR_ROW_ID (+)
AND (S_ORG_EXT.ROW_ID = S_CONTACT.PR_DEPT_OU_ID
OR S_ORG_EXT.ROW_ID = oxm2.accnt_id
OR S_ORG_EXT.ROW_ID = S_CONTACT_XM.attrib_05)
AND ORGEXT_REF.ROW_ID(+) = REFERRER.PR_DEPT_OU_ID
AND S_CONTACT.CON_ASST_PER_ID = Consultant.ROW_ID
AND S_ORG_EXT.X_DIRECTOR_ID = ProgramDirector.ROW_ID (+)
AND S_CONTACT.CREATED_BY = CallTaker.ROW_ID
AND S_CONTACT.ROW_ID = a.PR_CON_ID (+)
AND S_CONTACT.PR_PER_ADDR_ID = S_ADDR_PER.ROW_ID (+)
AND S_CONTACT_TNTX.PAR_ROW_ID (+) = S_CONTACT.ROW_ID
AND REFERRER.ROW_ID(+) = S_CONTACT_TNTX.REFERRED_BY_ID
AND a.PROD_ID = S_PROD_INT.ROW_ID (+)
AND O.CONTACT_ID (+) = S_CONTACT.ROW_ID
AND a.STATUS_CD (+) = 'Active'
AND a.TYPE_CD (+) ='Program'
AND S_CONTACT.ROW_ID = a2.PR_CON_ID (+)
AND a2.STATUS_CD (+) = 'Active'
AND a2.TYPE_CD (+) = 'Lifecycle'
AND a3.PR_CON_ID(+) = S_CONTACT.ROW_ID
AND a3.STATUS_CD (+) = 'Active'
AND a3.TYPE_CD (+) = 'HealthSheet'
AND S_CONTACT.X_JC_ACNT_NUM = ct.CLIENT_NUMBER (+)
--AND S_ORG_EXT.LOC NOT LIKE 'F%'
AND S_ORG_EXT.ACCNT_TYPE_CD NOT IN 'Division'
--AND S_ORG_EXT.Loc in (select to_char(centreid) from UPL_LIVE_CENTRES where LIVE = 'Y')
AND (trunc(S_CONTACT.LAST_UPD - (UTC_OFFSET/24)) = trunc(p_business_date) or trunc(S_CONTACT_X.LAST_UPD - (UTC_OFFSET/24)) = trunc(p_business_date) OR (S_CONTACT_XM.X_CONSULTATION_DT = p_business_date) OR oxm2.CONTACT_ID IS NOT NULL)
AND S_CONTACT.last_upd_by not in ('1-14WD')
AND oxm2.CONTACT_ID (+) = o.CONTACT_ID
AND S_ORG_EXT.LOC <> 'CW_846'
AND (a.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a.pr_accnt_id is null)
AND (a2.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a2.pr_accnt_id is null)
AND (a3.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a3.pr_accnt_id is null));
rollback;
END;
-------------------------------------------------------------------------------------------------- -
Tune the PL/SQL block with SQL_ID
Hi There,
I have found some recommendation in ADDM report as follows.
"" Action
Tune the PL/SQL block with SQL_ID "48trcns4mx5bk". Refer to the "Tuning
PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide and
Reference".
Related Object ""
can any one let me how to Tune the PL/SQL block with SQL_ID?
looking forward.
Db: 11.1.0.7
OS: OracleLinux5-86*64
Regards,
MohsinHi,
you can't tune a PL/SQL block directly. Instead, you'll need to profile it first (i.e. see how much time SQL statements inside it consume) using dbms_profiler or some other tool. If you find that the problem is that some SQL is called too frequently because of flawed PL/SQL logic, then you'll need to address that. Otherwise, you'll need to take the top time consuming statement(s) and tune it (them).
Best regards,
Nikolay -
Execute PL/SQL block with named binds from within java code?
Hi guys,
Is there any good way to execute my PL/SQL code, for example
BEGIN :x := :x+1; END;
from my Java code? I need nothing complicated, just static code block with named binds.
I have tried the Oracle exetnded JDBC (setXXXbyName methods):
public static void main(String[] args){ try { Class.forName("oracle.jdbc.driver.OracleConnection"); Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user","password"); String SQL="begin :x:=:x+1; end;"; OracleCallableStatement stmt; stmt=(OracleCallableStatement)conn.prepareCall(SQL); stmt.setIntAtName("x", 5); stmt.registerOutParameter("x", Types.INTEGER); stmt.execute(); System.out.println(stmt.getInt("x")); } catch (Exception x) { x.printStackTrace(); } }
And get the java.sql.SQLException: operation not allowed: Ordinal binding and Named binding cannot be combined!
Then i've tried SQLJ appoach:
public static void main(String[] args){ try { Class.forName("oracle.jdbc.driver.OracleConnection"); Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user","password"); Oracle.connect(conn); System.out.println("Connected!"); int x=3; #sql { BEGIN :x := :x+1; END; }; System.out.println("x=" + x); } catch (Exception x) { x.printStackTrace(); } }
And x=3 had retuned... Although 4 expected.
Then, I've set parameter sqlj.bind-by-identifier=true
And result is another exception! java.sql.SQLException: Missing IN or OUT parameter at index:: 2
Can you please mark my mistakes/point to correct solution?
Thanks in advance,
AlexeyFound another solution, this time working at least...
public void testPLSQL() {
String dynamicSQL=
"declare\n" +
" v_CursorID INTEGER;\n" +
" v_BlockStr VARCHAR2(500);\n" +
" v_Dummy INTEGER;\n" +
" v_x String(18);\n" +
"BEGIN\n" +
" v_CursorID := DBMS_SQL.OPEN_CURSOR;\n" +
" v_BlockStr :=?;" +
" DBMS_SQL.PARSE(v_CursorID, v_BlockStr, DBMS_SQL.V7);\n" +
" v_x:=?;"+
" DBMS_SQL.BIND_VARIABLE(v_CursorID, ':x', v_x,18);\n" +
" v_Dummy := DBMS_SQL.EXECUTE(v_CursorID);\n" +
" DBMS_SQL.VARIABLE_VALUE(v_CursorID, ':x', v_x);\n" +
" DBMS_SQL.CLOSE_CURSOR(v_CursorID);\n" +
" ?:=v_x;"+
" COMMIT;\n" +
"EXCEPTION\n" +
" WHEN OTHERS THEN\n" +
" DBMS_SQL.CLOSE_CURSOR(v_CursorID);\n" +
" RAISE;\n" +
"END DynamicPLSQL;";
try {
Class.forName("oracle.jdbc.driver.OracleConnection");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user", "password");
System.out.println("Profit");
String SQL="begin :x:=:x+1; end;";
OracleCallableStatement stmt;
stmt=(OracleCallableStatement)conn.prepareCall(dynamicSQL);
stmt.setString(1, SQL);
int x=3;
stmt.setInt(2, x);
stmt.registerOutParameter(3, Types.INTEGER);
stmt.execute();
x=stmt.getInt(3);
System.out.println(x);
assertEquals(4, x);
} catch (Exception ex) {
ex.printStackTrace();
assertTrue(false);
}Now the only thing I need is to code some kind of preprocessor of SQL block, to prepare the dynamicSQL lair for SQL critter...
Please please please show me something less complicated! :8} -
Oracle Forms - How can I create a Data Block with query
Dear friends I have a question, I couldn't do this..
I have a sql query, I want to show the datas of the query.. How can I do this. ?
Data Block Wizard wants a table, view or stored procedure, but I have a query, how can I create a data block with my query.. I m waiting your helps..? Please...
SemihHi,
You have two options
1. create a view and base the block on the view
2. create a block with a query Data Source Type of 'FROM clause query'
Hope this helps
Neil -
Block with more than one table type agurment - Update Procedure for Block
Hi,
I have one form with 3 Block. First Block is single row block, and other 2 are details block . The details balocks are based on the Procedure datasource, because of the complex query conditions. Now my requirement is When Inserting / Updating the Master Block (Single Row Block), I need to get the values in the two details block , because I need to update some other tables also based on these values. I created a procedure with two Table Type parameters (for each details block) , but when I using this procedure as the Update Procedure Name in the block, I am getting the error Only One table type arguement is allowed. Is there any other method to implement this.
Thanks in advance.Rizly,
A quick summary to make sure I understand your requirements. You have a single row base table master block with two detail blocks that are based on Procedures. When you update the single row base table master block, you need all of the data in the two procedure based detail blocks as there are updates that you have to perform to other tables that use this data. You have created a stored procedure that take two PL/SQL tables as parameters, but you are getting the error that only 1 table parameter is allowed.
I need to ask you a few questions first. What is your Forms version? The stored procedure you created; are you using this procedure in the "On-Insert, On-Update, On-Delete" triggers or do you call the procedure in one of the Base Table block ("Key-Commit, When-Button-Pressed" or other trigger)? When you modify or add a new Master block record are you adding values to the detail blocks or using values from the previous Master block record?
If you are using your procedure in the On-Insert, On-Update or On-Delete trigger(s), then based on your description, the error you are receiving is correct. The "On-..." triggers are constrained in that their procedures expect only a single PL/SQL table, Table of Records or Ref Cursor as a parameter. This is a Forms constraint - not a PL/SQL constraint as Forms is expecting you to only perform actions on the block where the "On-..." Trigger is located.
Perhaps you should consider creating a database Package that has two package specification constructs (Ref Cursor, Table of Records, etc) you can populate from Forms and then simply call the package procedure that will use the Ref Cursors to perform the needed update or inserts.
Hope this helps.
Craig...
If mine or someone elses response was helpful, please mark it accordingly -
Hello! I've the following pl/sql block and the problem is that when i execute my script the code gives to the V_RUT_EMPLEADO1 Pair Invoice, to V_RUT_EMPLEADO2 Odd Invoice
With the Ballots there's no problem at all.
V_RUT_EMPLEADO1 : Pair Ballot and Odd Invoice
V_RUT_EMPLEADO2 : Odd Ballot and Pair Invoice
DECLARE
V_RUT_EMPLEADO1 VARCHAR2(15) := '1234578-4';
V_RUT_EMPLEADO2 VARCHAR2(15) := '1457897-5';
CURSOR C_NUMDOCU IS
SELECT DISTINCT VEN_NUMDOCU
FROM VENTA
GROUP BY VEN_NUMDOCU;
BEGIN
FOR V_TUPLA1 IN C_NUMDOCU LOOP
DECLARE
CURSOR C_TIPODOC IS
SELECT VEN_TIPODOC, VEN_NUMDOCU
FROM VENTA;
BEGIN
FOR V_TUPLA2 IN C_TIPODOC LOOP
IF (V_TUPLA2.VEN_TIPODOC = 'B') THEN
IF (MOD(V_TUPLA1.VEN_NUMDOCU, 2) = 0) THEN -- Pair ballot
UPDATE VENTA SET RUT_EMPLEADO = V_RUT_EMPLEADO1
WHERE VEN_NUMDOCU = V_TUPLA1.VEN_NUMDOCU;
ELSIF (MOD(V_TUPLA1.VEN_NUMDOCU, 2) = 1) THEN -- Odd ballot
UPDATE VENTA SET RUT_EMPLEADO = V_RUT_EMPLEADO2
WHERE VEN_NUMDOCU = V_TUPLA1.VEN_NUMDOCU;
END IF;
ELSIF (V_TUPLA2.VEN_TIPODOC = 'F') THEN
IF (MOD(V_TUPLA1.VEN_NUMDOCU, 2) = 0) THEN -- Pair Invoice
UPDATE VENTA SET RUT_EMPLEADO = V_RUT_EMPLEADO2
WHERE VEN_NUMDOCU = V_TUPLA1.VEN_NUMDOCU;
ELSIF (MOD(V_TUPLA1.VEN_NUMDOCU, 2) = 1) THEN -- Odd Invoice
UPDATE VENTA SET RUT_EMPLEADO = V_RUT_EMPLEADO1
WHERE VEN_NUMDOCU = V_TUPLA1.VEN_NUMDOCU;
END IF;
END IF;
END LOOP;
END;
END LOOP;
END;Like Frank, I'm unsure whether the results you posted are correct or not so cannot really comment on your logic ther are a couple of things that come to mind.
If the PK of your table is ven_numdocu, ven_codproducto, then your outer cursor C_NUMDOCU actually selects all of the rows in the table venta since there is no where clause in that query, and the group by is unneccesary since, by definition, the combination of ven_numdocu and ven_codproducto is unique. Second, your inner cursor C_TIPODOC will only select a single row for each record returned by the outer cursor, because your where clause on that cursor selects by the PK. That is it will eventually select all rows in the table, and appears to be only used in place of a where clause in the update statement in the inner loop. Given that, it seems to me that you would only require a single cursor to loop through and update all of the records in the table venta.
On a stylistic note, I would not generally mix declared cursors and cursor for loops, but would use only one or the other style. Given a requirement for looping through a cursor, I would almost always use a cursor for loop, or an explicit cursor and a bulk collect. Given this is a homework assignment, bulk collect may be more advanced than your class has got to yet, but you may want to search this forum for examples and amaze your instructor :-).
Although I won't give you explicit code, I would write this block with the following structure:
DECLARE
v_rut_empleado1 VARCHAR2(15) := '1234578-4';
v_rut_empleado2 VARCHAR2(15) := '1457897-5';
BEGIN
FOR cur_rec IN (SELECT required_fields
FROM venta
WHERE <any predicates required to identify only the rows needing
updating if it is not all of the rows in the table>) LOOP
-- your update logic
END LOOP;
END;A couple of other notes. Your if statments can be flattened quite a bit which would make the logic a liitle easier to follow in my opinion. An if statement in PL/SQL can use more than one condition, that is you can do:
IF condition1 and condition2 THEN
do_thing1;
ELSIF (condition1 or condition3) and condition4 THEN
do_thing2;
ELSE
do_thing3;
END IF;Finally, assuming that your basic logic is correct, this can certainly be done as a single update statement unless it is an absolute requirement of the assignment to do it in a cursor loop. The equivalent to an IF/ELSIF expression in a SQL statement is a CASE expression like:CASE WHEN condition1 and condition2 THEN do_thing1
WHEN (condition1 or condition3) and condition4 THEN do_thing2
ELSE do_thing3 ENDA case expression can be used almost anywhere in a SQL statement, and seems perfect to me for your update logic here.
John -
Backup DB with dynamic sql - want to substitute in dbname and disk file path
Re: Backup DB with dynamic sql - want to substitute in dbname and disk file path
Hope I can explain this. Below is a small snippet of code. I want to set @SQLTemplate_TSQL once at the top of the script and then execute the SET @SQLCommand and sp_executesql in a loop that reads a list of databases. It all works, except for the
BACKUP DATABASE. Right now it evaluates when the SET @SQLTemplate_TSQL is evaluated. I want it to evaluate when it is executed. I want the DB_NAME() of the USE @dbname.
-- change @dbname and @dbbackuppath
DECLARE @SQLCommand NVARCHAR(MAX)
DECLARE @SQLTemplate_TSQL NVARCHAR(MAX)
DECLARE @dbname varchar(128) = 'Bank04'
-- one time setting of @SQLTemplate_TSQL
set @SQLTemplate_TSQL =
DECLARE @dbbackuppath varchar(128) = ''''d:\backups''''
IF RIGHT(@dbbackuppath, 1) <> ''''\''''
SET @dbbackuppath = @dbbackuppath + ''''\''''
SET @dbbackuppath = @dbbackuppath + DB_Name() + ''''.bak''''
PRINT @dbbackuppath
BACKUP DATABASE ' + DB_NAME() + ' to DISK=''' + QUOTENAME(@dbbackuppath, CHAR(39)) + '''
-- Execute this several times over different databases
SET @SQLCommand = '
USE ' + QUOTENAME(@dbname) + ';
EXEC(''' + @SQLTemplate_TSQL + ''') '
PRINT @SQLCommand
EXECUTE sp_executesql @SQLCommandHere is a stripped down version of my code. Someone writes a script. I then take the script and seperate it by GO statement block. Each GO block gets its own row into the
#SQLTemplate_TSQL. I then replace single quote with 4 quotes and run it. Then I run against my list of databases. I am unable to get the BACKUP DATA base to work with this model.
Run scripts against multiple databases.sql
Do a FIND on "CHANGE THIS" to see the databases returned from the SELECT statement
DECLARE @DatabaseName varchar(128)
DECLARE @SQLCommand NVARCHAR(MAX)
DECLARE @SQLTemplate_Seq INT
DECLARE @SQLTemplate_OperationDesc NVARCHAR(128)
DECLARE @SQLTemplate_TSQL NVARCHAR(MAX)
DECLARE @SQLTemplate_Diagnostics INT
DECLARE @Note VARCHAR(500)
IF OBJECT_ID('tempdb..#SQLTemplate_TSQL') IS NOT NULL
DROP TABLE #SQLTemplate_TSQL
CREATE TABLE [dbo].[#SQLTemplate_TSQL](
[SQLTemplate_RecID] [int] Identity,
[SQLTemplate_ID] [int] NOT NULL,
[SQLTemplate_Seq] [int] NOT NULL,
[SQLTemplate_OperationDesc] [varchar](128) NOT NULL,
[SQLTemplate_TSQL] [varchar](max) NOT NULL,
[SQLTemplate_Diagnostics] [int] NOT NULL,
[SQLTemplate_Enabled] [int] NOT NULL)
DELETE FROM #SQLTemplate_TSQL WHERE SQLTemplate_Seq = 65
DECLARE @SeqID INT
SELECT @SeqID = MAX(SQLTemplate_ID) FROM #SQLTemplate_TSQL
SET @SeqID = ISNULL(@SeqID,0)
SET @SeqID = @SeqID + 1
INSERT INTO #SQLTemplate_TSQL VALUES(@SeqID ,65,@SeqID,'
SELECT * FROM ifs_config
',1,1)
SET @SeqID = @SeqID + 1
INSERT INTO #SQLTemplate_TSQL VALUES(@SeqID ,65,@SeqID,'
DECLARE @HistoryODS INT
SET @HistoryODS = 1
SELECT * FROM ifs_tablelist WHERE HistoryODS = @HistoryODS and Tablename like ''''%HIST%''''
',1,1)
-- Setup Cursor to Loop through each of the Prior Period databases
DECLARE db_cursor CURSOR FOR
SELECT [Database Name] --<<<<<<<< CHANGE THIS SELECT statement to select DBs >>>>>>
FROM v_ifs_PPODSDBInfo_Curr
WHERE [Database Frequency] <> 'CURRENT'
ORDER BY [Database Frequency], [Database Number]
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @DatabaseName
-- Loop through each of the databases
WHILE @@FETCH_STATUS = 0
BEGIN
-- Setup Cursor to Loop through each of the SQL Statements
DECLARE #SQLTemplate_TSQL_cursor CURSOR FOR
SELECT [SQLTemplate_TSQL], [SQLTemplate_OperationDesc], [SQLTemplate_Seq], [SQLTemplate_Diagnostics]
FROM #SQLTemplate_TSQL
WHERE [SQLTemplate_Enabled] = 1 AND SQLTemplate_Seq = 65
ORDER BY SQLTemplate_ID
OPEN #SQLTemplate_TSQL_cursor
FETCH NEXT FROM #SQLTemplate_TSQL_cursor INTO @SQLTemplate_TSQL, @SQLTemplate_OperationDesc, @SQLTemplate_Seq, @SQLTemplate_Diagnostics
-- Loop through each of the SQL statements
WHILE @@FETCH_STATUS = 0
BEGIN
SET @SQLCommand = '
USE ' + QUOTENAME(@Databasename) + ';
EXEC(''' + @SQLTemplate_TSQL + ''') '
EXECUTE sp_executesql @SQLCommand
FETCH NEXT FROM #SQLTemplate_TSQL_cursor INTO @SQLTemplate_TSQL, @SQLTemplate_OperationDesc, @SQLTemplate_Seq, @SQLTemplate_Diagnostics
END
CLOSE #SQLTemplate_TSQL_cursor
DEALLOCATE #SQLTemplate_TSQL_cursor
FETCH NEXT FROM db_cursor INTO @DatabaseName
END
CLOSE db_cursor
DEALLOCATE db_cursor -
Block on PL/SQL Table of Record
Hi,
I am using Developer 6 with Oracle 8i, I based my block on PL/SQL procedure returning table of record, the form is running fine, but when ever I try to get data set, more then 200 rows, first it gows for query, working for a moment and then closed the form with out giving any result. And the least possible queryable data is 1000 to 30000.
It is working fine with less then 200 rows.
The form is also working fine with Ref Cursor with any of rows, but what I am doing is only possible with Table of record type.
Please give me your good advise what should I do.
Please accept my thanks in advance.
FahimThis should not happen. If you are not sure that your stored procedure is bug-free, you could generate and use stored procedures using my SQLPlusPlus and give it a try.
You can email me directly if your problem still not gets solved.
regards,
M. Armaghan Saqib
+---------------------------------------------------------------
| 1. SQL PlusPlus => Add power to SQL Plus command line
| 2. SQL Link for XL => Integrate Oracle with XL
| 3. Oracle CBT with sample GL Accounting System
| Download free: http://www.geocities.com/armaghan/
+---------------------------------------------------------------
null -
Controling Column Order for Report with Dynamic SQL
Hi,
I have a report region using Function block returning the SQL.
The output of the function will look like the following
SELECT NAME, CLASS1, CLASS2,CLASS3,CLASS4, AVERAGE_SCORE FROM XXXX;
The number of CLASSn column will be determine by the function based on the data. If the person doesn't have any score on CLASS4, the the SQL would not have CLASS4 column.
My problem with this is I can't control the order of column appearance.
For e.g : If my previous SQL is without CLASS4, when I query a person with CLASS4. The CLASS4 column will appear after the AVERAGE_SCORE.
NAME---CLASS1---CLASS2---CLASS3---AVERAGE_SCORE---CLASS4
I want it to maintain AVERAGE_SCORE as the last column.
Can you guys give a suggestion how to handle this?
Additional info :
- I am disabling the report header, setting it to None as the first row of the sql returned records is the header.
Cheers,
JoelHi all,
My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
Cheers,
Joel -
i am facing trouble with PS/SQL. when i execute the select statement alone in the format
update revenue a set a.status =
case when a.amount =
(select sum(amount)
from revenue b
where a.confirmationno=b.confirmationno
and b.date1 between(a.date1-1) and (a.date1+1)
and b.trantype='PMT')
THEN 'C'
ELSE 'P'
END
where a.trseqno=2 and a.trantype='AIR';
the update works fine. when it is grouped into the declare block like this
declare v_revenue revenue%rowtype;
begin
select * into v_revenue from revenue where trseqno=2;
update revenue a set a.status =
case when a.amount =
(select sum(amount)
from revenue b
where a.confirmationno=b.confirmationno
and b.date1 between(a.date1-1) and (a.date1+1)
and b.trantype='PMT')
THEN 'C'
ELSE 'P'
END
where a.trseqno=2 and a.trantype='AIR';
end;
i get the following error
The following error has occurred:
ORA-06550: line 6, column 1:
PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
( - + mod null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current max min prior sql stddev sum variance execute
forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
any help would be much appreciated
thanxUnless I'm misreading the documentation set,
it would depend on which database release
is used to determine whether CASE is supported
by PL/SQL or not. The CASE statement in PL/SQL
is supported in 9i.
Andy Beene
[email protected]
hi,
Case does not supported in pl/sql.
Yogi
[email protected] -
Create data base table with EXEC SQL
Hello,
I nead to create o data base table with EXEC SQL in an Abap program.
My code is :
TRY.
EXEC SQL.
CREATE table zt_hello ( mandt char(4) NOT NULL,
kunnr char(10) NOT NULL,
PRIMARY KEY (mandt, kunnr) )
ENDEXEC.
CATCH cx_sy_native_sql_error INTO exc_ref.
error_text = exc_ref->get_text( ).
ENDTRY.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
But it still not working.
Can you help me please.
Thanks.
Edited by: widad soubhi on Jul 14, 2010 5:26 PMPlease refer this code
REPORT z_struct_create .
DATA: my_row(500) TYPE c,
my_file_1 LIKE my_row OCCURS 0 WITH HEADER LINE.
DATA: dd02v TYPE dd02v.
DATA: my_file_tab1 LIKE dd03p OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text
NO INTERVALS.
PARAMETERS:
name TYPE ddobjname,
testo TYPE text40,
file_1 LIKE rlgrap-filename.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK blk.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_1.
PERFORM file_selection USING file_1.
INITIALIZATION.
text = text-001.
START-OF-SELECTION.
IF file_1 IS INITIAL.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 001.
EXIT.
ENDIF.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = file_1
filetype = 'ASC'
TABLES
data_tab = my_file_1.
IF sy-subrc 0.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 002.
EXIT.
ENDIF.
LOOP AT my_file_1.
IF sy-tabix > 1.
CLEAR my_file_tab1.
SPLIT my_file_1 AT ';' INTO
my_file_tab1-fieldname
my_file_tab1-datatype
my_file_tab1-leng
my_file_tab1-decimals
my_file_tab1-ddtext
my_file_tab1-inttype = 'C'.
my_file_tab1-INTLEN = my_file_tab1-leng.
my_file_tab1-tabname = name.
my_file_tab1-position = sy-tabix - 1.
my_file_tab1-ddlanguage = sy-langu.
my_file_tab1-OUTPUTLEN = my_file_tab1-leng.
APPEND my_file_tab1.
ENDIF.
ENDLOOP.
dd02v-tabname = name.
dd02v-ddlanguage = sy-langu.
dd02v-tabclass = 'INTTAB'.
dd02v-DDTEXT = testo.
dd02v-MASTERLANG = sy-langu.
IF NOT my_file_tab1[] IS INITIAL.
CALL FUNCTION 'DDIF_TABL_PUT'
EXPORTING
name = name
dd02v_wa = dd02v
TABLES
dd03p_tab = my_file_tab1
EXCEPTIONS
tabl_not_found = 1
name_inconsistent = 2
tabl_inconsistent = 3
put_failure = 4
put_refused = 5
OTHERS = 6
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 003.
EXIT.
ENDIF.
*& Form file_selection
-->P_FILE_1 text
FORM file_selection USING p_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'c:\'
mask = ',.,..'
mode = '0'
title = 'Selezione file'
IMPORTING
filename = p_file
RC = RCODE
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
ENDFORM. " file_selection
File Template:
Fieldname;Data Type;Lentgh;Dec.;Descr.
FIELD1;CHAR;000020;000000;my field 1
FIELD2;CHAR;000008;000000;my field 2
FIELD3;CHAR;000007;000000;my field 3
FIELD4;CHAR;000006;000000;my field 4 -
Populate block with an sorted array contents.
hey,
i'm trying to populate a block (forms 10 vs. db 10g) with data from an array.
the data should be sorted.
what is the easiest way to do it?
another deatails (array structure)) will supplied if nessecary.
thanks , yairHow do you populate your array? If you populate it with a query in some way the easiest way would be not to use an array at all and simply populate the block with your query. This would spare you manually populating the block and implementing a sort algorithm yourself (just use order by)
If the data comes from what ever else source a pipelined function comes to my mind which would enable you to query your array with SQL and letting the SQL Engine do the sort. You'd just have to use a from-clause query on your block
http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dcitblfns.htm
cheers -
Hot Data Block with concurrent read and write
Hi,
This is from ADDM Report.
FINDING 8: 2% impact (159 seconds)
A hot data block with concurrent read and write activity was found. The block
belongs to segment "SIEBEL.S_SRM_REQUEST" and is block 8138 in file 7.
RECOMMENDATION 1: Application Analysis, 2% benefit (159 seconds)
ACTION: Investigate application logic to find the cause of high
concurrent read and write activity to the data present in this block.
RELEVANT OBJECT: database block with object# 73759, file# 7 and
block# 8138
RATIONALE: The SQL statement with SQL_ID "f1dhpm6pnmmzq" spent
significant time on "buffer busy" waits for the hot block.
RELEVANT OBJECT: SQL statement with SQL_ID f1dhpm6pnmmzq
DELETE FROM SIEBEL.S_SRM_REQUEST WHERE ROW_ID = :B1
RECOMMENDATION 2: Schema, 2% benefit (159 seconds)
ACTION: Consider rebuilding the TABLE "SIEBEL.S_SRM_REQUEST" with object
id 73759 using a higher value for PCTFREE.
RELEVANT OBJECT: database object with id 73759
SYMPTOMS THAT LED TO THE FINDING:
SYMPTOM: Wait class "Concurrency" was consuming significant database
time. (4% impact [322 seconds])
what does it mean by hot block with concurrent read and write??
is rebuilding the table solves the problem as per addm report?Hi,
You must suffer from buffer busy waits.
When a buffer is updated, the buffer will be latched, and other sessions can not read it or write it.
You must have multiple sessions reading and writing that one block.
Recommendation 2 results in fewer records per block, so less chance multiple sessions are modifying and reading 1 block. It will also result in a bigger table.
The recommendation doesn't make sense for tablespaces with segment storage management auto, as for those tablespaces pctfree does not apply.
Buffer busy waits will also occur if the blocksize of your database is set too high.
Sybrand Bakker
Senior Oracle DBA -
XML Publisher Report with PL/SQL
Hi
Like to know how to develop the XML Publisher Report with PL/SQL, i did the following
1. created a pkg like as below
CREATE OR REPLACE PACKAGE BODY APPS.TEST_XMLTAG_PKG AS
PROCEDURE main (errbuf OUT VARCHAR2,
retcode OUT NUMBER
) IS
BEGIN
DECLARE
ctx DBMS_XMLGEN.ctxHandle;
xml CLOB;
BEGIN
ctx := dbms_xmlgen.newcontext('select * from scott.emp');
dbms_xmlgen.setrowtag(ctx, 'MY-ROW-START-HERE');
xml := dbms_xmlgen.getxml(ctx);
dbms_output.put_line(xml);
Fnd_file.put_line (fnd_file.LOG, XML);
END;
END;
END TEST_XMLTAG_PKG;
this pkg produces the output with xml tag in the view log.
I have registered the conc program & xml rtf but it does not produce the output in PDF, , I am not able to get the xml tag when i click the Diagnostics --> View XML.
can you please let me know the next steps involved.
Regards
YramI think the problem is because there is no begin and end tag. save the xml from the logfile and open with xml editor or IE.. then you will see the problem.
add Begin and end tag...then you should be fine.. i.e
fnd_file.put_line(fnd_file.output,'<EMP_DATA>'); -- begin Tag
tx := dbms_xmlgen.newcontext('select * from scott.emp');
dbms_xmlgen.setrowtag(ctx, 'MY-ROW-START-HERE');
xml := dbms_xmlgen.getxml(ctx);
dbms_output.put_line(xml);
Fnd_file.put_line (fnd_file.LOG, XML);
fnd_file.put_line(fnd_file.output,'</EMP_DATA>'); -- End Tag
Hope this helps..>Good Luck
Ravi
Maybe you are looking for
-
2011 Macbook Air 13" or 2011 Macbook Pro 17"? Which to get?
Hello there, I just bought my 2011 17" macbook pro exactly one week ago from Best Buy (They have a 36 month 0% financing deal going on at mine) and I just downloaded and installed OS X Lion on it yesterday and I'm pretty happy with it. HOWEVER,if the
-
Foreign Trade incompletion.
Hi, When releasing the billing document to accounting, we are facing custom/office exit(ZOLLA) missing. This incompletion is not allowing us to post the document. We would like to remove it from incompletion log. We dont have any incompletion procedu
-
Connection Pooling in Tomcat 4.1.18
Hi, Can anyone point me to a decent resource on how to implement Oracle connection pooling in Tomcat? I'm using the UltraSearch API's for an application and cannot get it to work correctly with the DBCP implementation that I currently use. Many thank
-
Hi All, I have searched for some good books for the certification online, could you please tell me if any one has taken this certification and what books I should using for the certification. I am mentioning some books below: SAP Certified Developmen
-
OS 10.3.9 Running slowly and behaving oddly
My system has been behaving oddly recently. In every application and category therefof. Pages load very slowly, then normally. Sometimes they won't load at all, can't find the server, then they load immediately a few moments later. Various applicatio