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
#! Pavan

Hello 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;
--------------------------------------------------------------------------------------------------

Similar Messages

  • What will happen to the data block after data offloading?

    HI All,
    Since offloading can filter out the necessary information such as unnecessary columns and rows before they are passed to the database, I want to know what will happen to the data block? Will some new blocks be built at this time,which only contains the useful information?
    Best regards,
    Leon

    Andy Klock wrote:
    The statement seems to imply that Exadata has the ability to strip out columns from a block, but a block is a block is a block. Offloading is remarkable at filtering out data in the storage layer that ultimately is not needed but if you only need one row in a block that has 100 rows in it, you still get the whole block (and all 100 rows) to be processed by Oracle. The columns portion of the statement is when HCC is used for a table allowing only the blocks containing the column data required for the query, and thus if a block has 1000 column values in it, it will pass all 1000 column values to the instance to be processed.These assertions are incorrect.
    Blocks sent to the database grid as a result of a Smart Scan contain only the necessary columns and rows for the db grid to do its processing (after filter restrictions and projection restrictions are applied). These Smart Scan blocks are created at run time by the storage server so they have no bearing on the blocks that reside physically on disk which is why they can not be reused by other queries via the SGA and are read directly into the PGA space.
    Regards,
    Greg Rahn | blog | twitter | linkedin

  • On my itouch 4th gen, I use imessage and message many people, but sometimes when i send a message the send bar on top will go almost all the way and stop. This will happen for some time and then work later. is there anything to avoid the freezinginsending

    On my itouch 4th gen, I use imessage and message many people, but sometimes when i send a message the send bar on top will go almost all the way and stop. This will happen for some time and then work later. is there anything to avoid the freezing problem while it sends

    See:
    iOS: Troubleshooting Messages
    However, I suspect it is just a tempery network problem beyond your control

  • Creating Web service for PL/SQL Procedure with Complex Data Types

    I need to created web service for PL/SQL Procedure with Complex Data types like table of records as parameters, how do we map the pl/sql table type parameters with web service, how to go about these?

    Hello,
    When you are creating a service from a Stored Procedure, the OracleAS WS tools will create necessary Java and PL wrapper code to handle the complex types (table of record) properly and make them compatible with XML format for SOAP messages.
    So what you should do is to use JDeveloper or WSA command line, to create a service from your store procedure and you will see that most of the work will be done for you.
    You can find more information in the:
    - Developing Web Services that Expose Database Resources
    chapter of the Web Service Developer's guide.
    Regards
    Tugdual Grall

  • When I add a https link to quicklinks, when I click on it, the (:) after https does not go to the address bar and thus the link is not connected. This is happening for all quicklink bookmarks with https:

    Question
    When I add a https link to quicklinks, when I click on it, the (:) after https does not go to the address bar and thus the link is not connected. This is happening for all quicklink bookmarks with https: Is there a solution?

    Try some basic troubleshooting.
    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings, disables most add-ons (extensions and themes).
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu:
    *In Firefox 29.0 and above, click the menu button [[Image:New Fx Menu]], click Help [[Image:Help-29]] and select ''Restart with Add-ons Disabled''.
    *In previous Firefox versions, click on the Firefox button at the top left of the Firefox window and click on ''Help'' (or click on ''Help'' in the Menu bar, if you don't have a Firefox button) then click on ''Restart with Add-ons Disabled''.
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    When the Firefox Safe Mode window appears, select "Start in Safe Mode".<br>
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.

  • 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,
    Mohsin

    Hi,
    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

  • Is there a linear equations VI thatI can use for inputting the coefficients with variables attached to them? Thank you.

    Is there a linear equation VI that I can use for inputting the coefficients with variables attached to them? I am currently studying elec engineering and am in the thick of transient analysis. It is very time consuming figuring the mesh and nodal analysis in the transform domain. With 3 branches in a mesh analysis the resistors, inductors and capacitors are represented with variable s in them. I need to determine in the transform domain then convert to the time domain. One equation goes like this: (3+2s+1/4s)i1s - (2s)i2s - (1/4s)i3s = 6/s -6. The other equations are similar. I must keep the variable s in the equation and solve it with s in the result. I made several VIs for determining simultaneous linear equations some for complex numbers and they work great. This one has me a little stumped. I thinking that maybe Labview doesn't have a VI for this. The other VIs were fine because you just plugged in the numbers and ran the VI and got your result. Any VIs that do LaPlace transform operations?
    Thank you.
    Tom

    Hello Tom,
    You can find a VI for doing Laplace transforms in Functions->Analyze->Signal Processing->Frequency Domain (this VI is only available in the Full and Professional versions).
    You may also find the following tutorial of help in working with linear systems in LabVIEW.
    Linear Systems in LabVIEW
    Keep up to date on the latest PXI news at twitter.com/pxi

  • SQL logic help for pl/sql block

    Hi All,
    I need your suggestions and comments for the below issue:
    I have two tables: table A and table B
    Table A has two columns as id and counts:
    Id Counts
    99 10
    999 13
    9999 7
    Table B has two columns as Id and order:
    Id Order
    99 1
    999 2
    9999 3
    We need to update Order in Table B such that Id having highest count in table A has Order as 1 in table B and it keep on increasing the order for other Ids based on decreasing counts in table A. This will be like a job which will run daily and look for counts in table A and update Order in table B according to it.
    It seems to be simple but i am not getting it. Please help me out of this by writing some PL/SQL block.
    I will really appreciate your all comments and responses.
    Regards
    Dev

    Hi,
    Keen2Learn wrote:
    Hi All,
    I am really greatful to all fo you for all your replies and comments. I change ORDER table to ORDERS. All you replies worked for me but there is some slight change in scenario which i need to discuss with you all.
    E.g: Table A has 10 rows like below:
    Id Counts Type
    99 10 A
    999 13 A
    9999 7 C
    99 4 B
    999 2 C
    88 2 A
    77 1 C
    777 3 B
    777 5 A
    888 2 CIf you'd like help, please post CREATE TABLE and INSERT statements for your sample data (including table b as it is before the UPDATE or MERGE).
    I populate data in Orders column Table B based on id, by grouping sum of counts for that id in table A.
    Id 999 has highest sum(count) as 15, so it has orders as 1 in Table B and do same for descending counts for each Id.
    Table B has 5 rows like below:
    Id Orders
    99 2
    999 1
    88 4
    777 3
    555 5
    Assume Table B as static(no new record comes in it) but only its Orders changes for each Id based on counts for that Id in Table A. As you see, Table B has id 555 which is not in Table A, so we need to update its orders to the highest number by taking its Count as 0(zero). Sorry, it's unclear what you want to do.
    Post what you'd like table b to look like after the UPDATE or MERGE.
    Right now i am doing it like this:
    declare
         cursor c1 is
         select Id, SUM (COUNT), RANK () OVER (ORDER BY SUM (COUNT)) rnk
         from TableA      AND Id IN (SELECT Id FROM TableB)
    GROUP BY Id
    ORDER BY rnk DESC;
    i NUMBER := 1;
    begin
    for curr in c1
    loop
         update TableB      
    set orders = i
         where id = curr.id;
         i := i + 1;
    end loop;
    end;I'm not sure what you're trying to do, but I'll bet you don't need PL/SQL to do it. Use a single UPDATE or MERGE statement (inside PL/SQL if necessary).
    But it is not updating orders for Id 555 in TableB.There is no row for id=555 in table b, and, according to your requirements, there never will be, because "Table B as static(no new record comes in it)". It's behaving exactly as you said you wanted it to. What's the problem?
    Please provide your suggesstions on what needs to be done to take care of this scenario. I will really appreciate your all suggesstions and comments. Please let me know if need some more explanation.Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.

  • What will happen for games after restoring?

    Hello,
    As my iphone has problem with push notification and it sends them even after reading the message, I want to restore my phone.  I have backup on iTuens but not sure if I restore to them it solves my problem, because created the backup last night, when there was this problem.
    Also I am not sure what will happen on some games like NFS or Temple Run? How can I have the corrent score on the restored game?
    Thanks,

    Hard to say, but if your problem is being caused by corrupt data on your phone, restoring from backup will merely restore the problem. What you could do is first try restoring from backup. If your issue is fixed, you're good to go. If not, then you'll have to restore as new.

  • Can't create a sequence within a pl/sql block with execute immediate.

    Hi All. I created a user and granted it the 'create sequence' privilege though a role. In a pl/sql block I try to create a sequence using 'execute immediate' but get a 1031-insufficient privileges error. If I grant create sequence directly to the user, the pl/sql block completes successfully. Can anyone explain this behavior? We're running 11.2 Enterprise Editon.
    Thanks,
    Mark

    In a definer's rights stored procedure (the default), you only have access to privileges that have been granted directly, not via a role.
    There are two basic reasons for that. First, roles can be enabled or disabled, default and non-default, password-protected, etc. so the set of roles a particular user actually has is session-specific. Oracle needs to know at compile time what privileges the owner of the procedure has. The only way to do that (without deferring the privilege check) is to ignore privileges granted through roles.
    Second, since 99% of privilege management DBAs do involves granting and revoking roles, it's helpful that changing role privileges will never cause objects to be marked invalid and recompiled which can have side-effects on applications. DBAs only need to worry about causing problems on those rare cases where they are granting or revoking direct privileges to users.
    You can create an invoker's rights stored procedure by adding the clause (AUTHID CURRENT_USER). That defer's the security check to run-time but allows the procedure to see privileges granted through roles in the current session. But that means that the caller of the procedure would need to have the CREATE SEQUENCE privilege through the role, not the owner of the procedure.
    And just to make the point, dynamic object creation in PL/SQL is almost always a red flag that there is something problematic in your design. If you are creating sequences dynamically, that means that you'd have to refer to them dynamically throughout your code which means that your inserts would need to use dynamic SQL. That's not a particularly easy or safe way to develop code.
    Justin

  • PL/SQL Block with Cursor

    I was trying to create a PL/SQL block where I am trying to call all the SQL Plans and then drop them one by one. Here is how I am doung -
    SET SERVEROUT ON;
    DECLARE
    EXECSTR VARCHAR2(50);
    v_plans_dropped pls_integer;
    CURSOR C1 IS SELECT SQL_HANDLE FROM DBA_SQL_PLAN_BASELINES;
    BEGIN
    FOR I IN C1 LOOP
    EXECSTR := ''''||I.SQL_HANDLE||'''';
    v_plans_dropped:=dbms_spm.drop_sql_plan_baseline(sql_handle=>EXECSTR);
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR while dropping SQL PLAN: ' || SQLCODE || ' : ' || SQLERRM);
    END;
    This is giving me error like - ERROR while dropping SQL PLAN: -38131 : ORA-38131: specified SQL handle
    'SYS_SQL_1470897e7b72c982' does not exist
    Whereas this SQL Plan is there in the baseline - SELECT sql_handle FROM dba_sql_plan_baselines;
    SQL_HANDLE
    SYS_SQL_1470897e7b72c982
    SYS_SQL_75ac336a8071cb06
    SYS_SQL_269cdcd4862f8685
    SYS_SQL_269cdcd4862f8685
    SYS_SQL_0ffdb3bddbe422e2
    SYS_SQL_14d81bbae4a7cc93
    SYS_SQL_5c512b58e7795ba2
    SYS_SQL_33515785e80b75d0
    Above PL/SQL block should be same as like deleting it one by one -
    DECLARE
    v_plans_dropped pls_integer;
    BEGIN
    v_plans_dropped:=dbms_spm.drop_sql_plan_baseline(sql_handle=>'SYS_SQL_1470897e7b72c982');
    END;
    If I run this then it will be sucessul but when I run under a PL/SQL block using cursor then it is giving me error ORA-38131.
    Can you please tell me where I am going wrong here.
    Thanks for your time!

    I have this PL/SQL block -
    DECLARE
    v_plans_dropped pls_integer;
    CURSOR C1 IS SELECT SQL_HANDLE FROM DBA_SQL_PLAN_BASELINES;
    BEGIN
    FOR I IN C1 LOOP
    v_plans_dropped:=dbms_spm.drop_sql_plan_baseline(sql_handle=>I.SQL_HANDLE);
    END LOOP;
    END;
    Requirement - This PL/SQL block should read all the records from DBA_SQL_PLAN_BASELINES table and drop all the plans one by one.
    Problem - It gives me error like this -
    SQL> 2 3 4 5 6 7 8 9 DECLARE
    ERROR at line 1:
    ORA-38131: specified SQL handle SYS_SQL_45c1170505dda9a9 does not exist
    ORA-06512: at "SYS.DBMS_SPM", line 2444
    ORA-06512: at line 6
    Analysis: When I ran it 4 times, it showed me that the remaining records after the pl/sql run was like -
    SQL> SELECT COUNT(*) FROM DBA_SQL_PLAN_BASELINES;
    After First Run -
    COUNT(*)
    33429
    After Second Run -
    COUNT(*)
    33255
    After Third Run -
    COUNT(*)
    33228
    After Fourth Run -
    COUNT(*)
    32988
    So, it deletes records but errors out in between. Is it because the PL/SQL block/cursor is not structured properly?
    Thanks for your advice!

  • Creating a PL/SQL-Block with Boolean-Return and Check

    Hello folks,
    I have some kind of tricky problem. Actually, I want to integrate a small Task-System on my Apex 2.2 installation. Every task is intended to have a field with a anonymous PL/SQL-block in the shape of:
    Declare
    Begin
    return true/false;
    End;
    It is comparable to the condition-PL/SQL-block you can set for almost ev'ry item.
    It's not the problem to write this block half-automated, but how do I check it? Is there any kind of Database-Function?
    Thanks for your replies.
    Matthias.

    I believe Struct is basically used for SQL types , and your 'T_NACHRICHT' is a type of Objects so please pass the objects array to STRUCT.
    For example if type is :
    CREATE OR REPLACE TYPE T_NACHRICHT AS OBJECT
    ID_Nachricht NUMBER,
    ID_Vorgang NUMBER,
    --datum                 TIMESTAMP(6),
    Betreff VARCHAR2(400),
    -- Nachricht CLOB,
    ID_Antwort NUMBER,
    ist_neu VARCHAR2(5),
    CONSTRUCTOR FUNCTION T_NACHRICHT(
    p_ID_Vorgang NUMBER,
    p_Betreff VARCHAR2) RETURN SELF AS RESULT
    then call the struct in below way:
    STRUCT nachrichtSTRUCT = null;
    StructDescriptor structDesc = StructDescriptor.createDescriptor("T_NACHRICHT", conn);
              Object [] obj = {123456,123456,"ABC",123456,"ABCD"};
    nachrichtSTRUCT = new STRUCT(structDesc, conn, obj);

  • Pl/sql block with "insert into" and schema qualified table throws "error"

    Simplified test case:
    Oracle9i EE Release 9.2.0.3.0
    Oracle JDeveloper 9.0.3.2 Build 1145
    create user u1 identified by u1
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u1;
    revoke unlimited tablespace from u1;
    create user u2 identified by u2
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u2;
    revoke unlimited tablespace from u2;
    As user u2:
    create table u2.t
    c1 number
    grant select, update, insert, delete on u2.t to u1;
    As user u1:
    create or replace package test_pkg as
    procedure do_insert (p_in number);
    end;
    create or replace package body test_pkg as
    procedure do_insert (p_in number) is
    begin
    insert into u2.t values (p_in);
    commit;
    end;
    end;
    All of the above works fine using command-line sql*plus, and is clearly a simplified version of the actual code to demonstrate the issue at hand. Using JDeveloper, it complains about 'expected ;' at the 'values' keyword in the insert statement. Removing the schema qualification from the table name allows JDeveloper to not flag the statement as an error, but I do not want to create synonyms (private or public) to point to all the tables in the real packages. Since JDeveloper flags the insert statement as an error, I can not browse the package structure etc, even though it compiles with no problems. What gives?
    Thanks in advance for any suggestions, etc...

    Hi Bryan,
    Thanks for following up on this. I will look for the bug fix to be published.
    - Mark

  • 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,
    Alexey

    Found 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 XML Parser for PL/SQL - troubles with charset

    Hi,
    I'm using Oracle XML Parser for PL/SQL and have some troubles with charset of results xmldom.writeToBuffer and xmldom.writeToCLOB procedures.
    Some tags in my DOM documents contain text values in RUSSIAN (server nls_charset is CL8ISO8859P5). When I write document in varchar2 variable, buffer content is in UTF8 charset ( convert UTF8->CL8ISO8859P5 -OK).
    xmldom.setCharset(doc, 'ISO-8859-5') just after xmldom.newDOMDocument has no effect.
    xmldom.setCharset(doc, 'CL8ISO8859P5') has no effect also.
    Explicit charset direction in third parameter of
    xmldom.writeToBuffer and xmldom.writeToCLOB procedure has no effect.
    When I write document in CLOB, and then read part of CLOB in varchar2 buffer - result contain '?' in place of all russian text characters.
    What's a problem?
    How can I force XML Parser write XML in server charset?
    Oracle XML Parser for PL/SQL v 1.0.2

    I have the same problem. But in my case I am allowed only to use XML Parser for PL/SQL.
    Characterset 'WE8ISO8859P1' is used. And the language is latvian.
    After parsing a XML document and printing its contents, all latvian characters are replaced by "f".
    xmldom.setcharset(doc,'WE8ISO8859P1') has no effect.

Maybe you are looking for

  • How is it possible to connect more than one SAP R/3 4.6c System to TREX 6.1

    Hi, I'm using SAP TREX 6.1 together with an 4.6c System. Now I want to connect the TREX to more than one R/3 System, so that every R/3 System has got its own Index-Category on the TREX Host. Does somebody know what I have to enter in the ini files --

  • Outlook connector calendar problem

    Dear All I having problem with outlook connector, my users are able to see each others calendar from /uwc but they are not able to browse each other calendar from outlook, I have read something in regards of aci setting in ldap directory but I have n

  • Unexplained incompatibility with Apple Mail / pop services

    I am a technician that supports numerous clients using Apple Mail. I am increasingly running into compatibility problems with Apple Mail. Certain pop accounts will not download at all, for instance 123-reg.co.uk (pophost.123-reg.co.uk). The app seems

  • Data Load failure

    Hi all, when I am loading a data it is failinf and throwing a error as "error in data selection" ... is I have to check in r/3 system and how to do that? regards, Nandini

  • Sticky notes in iOS App

    I have a Adobe PDF document the i want to add sticky notes to in the Adobe App on iOS. However when I click the edit option it tells me the document is protected. The documents securtiy settings are: Adding sticky notes works fine on a pc. Is there a