SQL Source in Page with variables

Hello,
I need to define a page source with conditions in the where statement.
I.E. Select * from myTable where myField = myVar1.
The where statement should only be used, if a textbox :myBox contains a specific value.
The content of myVar1 should also vary with regard to the value in :myBox.
How can I do this?
Thanks in advance for you help.
Edited by: kps204020 on 05.10.2012 16:09

Select * from myTable where (myField = :P1_PAGE_ITEM or nvl(:P1_PAGE_ITEM,-1) =-1)
Assumming myField is a numeric field and P1_PAGE_ITEM is your myVal1 and is suppose to be a number. I would should you use bind variables for security reasons.

Similar Messages

  • 3 column page - how to make each full height of page, with variable content in each?

    Hi everyone. . . I'm a relatively unsophisticated page designer, and I appreciate if you excuse my lack of experience.  I'm putting together a page for a business.  The page has three columns, one of which would be considered to be the main body of the page. . . the one with all the important content.  The column on the left is for a navbar and some affiliate badges, and the column on the right will be for an image that describes for the viewer which page they're on. 
    The question I have is how to, when the content of the center column is very long, make the left and right column divtags extend all the way to the footer, with their borders and background colors, to make a clean page.  When the content of the center column is short, like a paragraph or two, the left divtag will have a minimum height due to the presence of the badges, but the right divtag is quite short.
    I uploaded a test page here: http://www.thermalifegroup.com/test/about_us.html
    Nevermind the visual appearance of the page. . . the spry widget is all over the place, but that's just because I uploaded a few files onto the server.  On my pc it's all copacetic and not an issue.  The code source is up there, so is the stylesheet. 
    I'm hoping I can just add a few attributes to the columns so that they automatically reach down to the bottom extents of the page.  Thanks for any advice you can throw my way.
    Keith

    manliusvalerius wrote:
    Hi everyone. . . I'm a relatively unsophisticated page designer, and I appreciate if you excuse my lack of experience.  I'm putting together a page for a business.  The page has three columns, one of which would be considered to be the main body of the page. . . the one with all the important content.  The column on the left is for a navbar and some affiliate badges, and the column on the right will be for an image that describes for the viewer which page they're on. 
    The question I have is how to, when the content of the center column is very long, make the left and right column divtags extend all the way to the footer, with their borders and background colors, to make a clean page.  When the content of the center column is short, like a paragraph or two, the left divtag will have a minimum height due to the presence of the badges, but the right divtag is quite short.
    I uploaded a test page here: http://www.thermalifegroup.com/test/about_us.html
    Nevermind the visual appearance of the page. . . the spry widget is all over the place, but that's just because I uploaded a few files onto the server.  On my pc it's all copacetic and not an issue.  The code source is up there, so is the stylesheet. 
    I'm hoping I can just add a few attributes to the columns so that they automatically reach down to the bottom extents of the page.  Thanks for any advice you can throw my way.
    Keith
    in your #main css style add following attributes
    float:left
    background-color:#eeeeee
    u can change ur color
    try

  • SQL Query in JSP with variable problem

    Researching this but I haven't found an answer yet. I want to pass a user variable to the SQL query. Anyone know how? Thought the form call out might work but it doesn't. Thanks!     <%
         String selectX = request.getParameter("choice");
         String pSQLStr = "SELECT asset, tenant FROM fritco WHERE asset = '::selectX::'";
              try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection con = DriverManager.getConnection("jdbc:odbc:MyDataSource", "username", "password");
              Statement stmt = con.createStatement();
              ResultSet result = stmt.executeQuery(pSQLStr);

    Yes.
    Use a Prepared Statement.
    Saves you from sql injection attacks.
    String selectX = request.getParameter("choice");
    String pSQLStr = "SELECT asset, tenant FROM fritco WHERE asset = ?";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:MyDataSource", "username", "password");
    PreparedStatement stmt = con.prepareStatement(pSQLStr);
    stmt.setString(1, selectX);
    ResultSet result = stmt.executeQuery(); Suggestions for improvements.
    - Set up a JNDI datasource to retrieve your connection from. WIll do connection pooling for you, rather than creating a new DB connection each time.
    - Don't have any sql code in your JSP at all - that should be in beans.
    - If sql code MUST be in your JSP, use a taglib for it like the JSTL sql taglib
    - Don't use scriptlet code (<% %>) in JSPs. If you want to run java code use beans/servlets.
    Cheers,
    evnafets

  • How do I Pass a parameter to a SQL Component Task where the source SQL statement is also a variable

    Hi,
    I have been tasked with making a complex package more generic.
    To achieve this I need to pass a parameter to a SQL Component Task where the source SQL statement is also a variable.
    So to help articulate my question further I have create a package and database as follows; -
    USE [KWPlay]
    GO
    /****** Object: Table [dbo].[tblTest] Script Date: 05/14/2014 17:08:02 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[tblTest](
    [ID] [bigint] IDENTITY(1,1) NOT NULL,
    [Description] [nvarchar](50) NULL,
    CONSTRAINT [PK_tblTest] PRIMARY KEY CLUSTERED
    [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    I populated this table with a single record.
    I unit tested the SQL within SSMS as follows;
    SELECT * FROM dbo.tblTest
    Result; -
    ID           
    Description
    1             
    Happy
    DECLARE @myParam NVARCHAR(100)
    SET @myParam = 'Sad'
    UPDATE dbo.tblTest SET [Description] = @myParam FROM dbo.tblTest WHERE ID = 1
    SELECT * FROM dbo.tblTest
    Result; -
    ID   
    Description
    1    
    Sad
    Within the package I created two variables as follows; -
    Name: strSQL
    Scope: Package
    Data Type: String
    Value: UPDATE dbo.tblTest SET [Description] = @myParam FROM dbo.tblTest WHERE ID = 1
    Name: strStatus
    Scope: Package
    Data Type: String
    Value: Happy
    I then created a single ‘Execute SQL Task’ component within the control flow as follows; -
    However when I run the above package I get the following error; -
    SSIS package "Package.dtsx" starting.
    Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "UPDATE dbo.tblTest SET [Description] = @myParam FR..." failed with the following error:
    "Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Task failed: Execute SQL Task
    Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. 
    The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the
    errors.
    SSIS package "Package.dtsx" finished: Failure.
    I also tried; - 
    Name: strSQL
    Scope: Package
    Data Type: String
    Value: UPDATE dbo.tblTest SET [Description] = ? FROM dbo.tblTest WHERE ID = 1
    However I received the error; - 
    SSIS package "Package.dtsx" starting.
    Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "UPDATE dbo.tblTest SET [Description] = ? FROM dbo...." failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with
    the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Task failed: Execute SQL Task
    Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches
    the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
    SSIS package "Package.dtsx" finished: Failure.
    Kind Regards,
    Kieran.
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Tried; - 
    Name: strSQL
    Scope: Package
    Data Type: String
    Value: UPDATE dbo.tblTest SET [Description] = ? FROM dbo.tblTest WHERE ID = 1
    and; - 
    Result; - 
    SSIS package "Package.dtsx" starting.
    SSIS package "Package.dtsx" finished: Success.
    Therefore the answer was to put the parameter number rather than the parameter name under the parameter mapping tab-> parameter name column. 
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

  • Tagging Individual Pages with SiteCatalyst Variables in CQ5

    Hey Guys,
    I'm struggling with tagging individuals pages with SiteCatalyst variables in CQ5. I'm looking for insight/guidance around the following categories:
    -CQ Variable documentation: Within the configuration environment, items under the CQ variable column (“pagedata.title”, “pagedata.path”, “pagedata.navTitle”, etc.) appear. Do you have any documentation for each term?
    -SiteCatalyst variables: Within the configuration environment,  users can drag and drop SiteCatalyst custom variables into any CQ Variable buckets (“pagedata.title”, “pagdata.path”, “pagedata.navTitle”, etc.). Do you have any examples successfully mapping SiteCatalyst and CQ5 variables together?
    -SiteCatalyst view: Within the configuration environment, this page’s options are unclear. Any information or guidance would be highly appreciated.
    - View pages within CQ5: After viewing the Connecting CQ with Adobe SiteCatlayst documentation, within the “ADDING CLICKSTREAM  CLOUD VARIABLE MAPING” section, it appears users can tag pages with custom variables. Enabled within the “Page Properties” tab, I’m unable to find this section.
    Any help would be HIGHLY appreciated!!!
    Thanks
    -Chad

    Thanks Roland,
      To give you more information. We discovered the source of the multiple instantiations of tabs from the page properties. We have a listener on the dialog.xml for our pages that listens for loadcontent events. In the course of its logic, the javascript for this listener will invoke dialog.loadContent(path) itself. Thus the double calls. Strictly speaking, we could look at ways to avoid the use of the loadContent call. But we also feel that there is something going on with regards to siteCatalyst and double-loading. This might be something you'll want to incorporate in your efforts to reproduce this. For posterity, here's a sample listener definition in our dialog.xml
    <listeners
            jcr:primaryType="nt:unstructured"
            loadcontent="function(dialog, records, opts, success) {CQ.Acme.populateShortURL(dialog, records, opts, success);}"/>
    Hope this helps!

  • F12 browser test serving a blank page with no html or other source

    I've been struggling to start using my local test server again.  It was working about a year ago when I last used it, but now, I get only a blank page back when I do the browser test (F12).
    It took awhile to get Wamp to just start up (icon was orange).  Turned out to be a Port 80 conflict issue.  Eventually changed Skype port and Wamp now starts fine (icon green).
    I've documented all the settings in both Wamp and DW to make sure everything is pointing to the right place, but still only get blank pages back when viewing in Firefox.
    For some additional testing I made a copy of the html file on the test server but still got the same results.
    Any ideas on what to try next?
    Thanks
    Tom

    Rob,
    You're right.  To avoid adding variables, all my testing now is using the index.htm file at the server root (i.e. CnA_Test_Server/index.htm).
    What then do you get when you just type:
    http://localhost
    I get the same result as using F12 within DW (i.e. blank page with no page source).
    I went back to look at Apache httpd.conf.  I think there are only 4 settings I've ever looked at.  The 2 relevant to root directory and the two relevant to the listening port.  The directory ones (document root and <directory>) should be fine (C:/wamp/www).  The two port ones are the only ones changed since last successfully using the test server.
    The only difference I can think of between the working WAMP of a few months back and now was the issue with Port 80 .  That problem didn't exist the last time I used the test server successfully some months back.  Obviously, since then at least 2 apps have been installed that also listen via 80: Skype and whatever is using MS IIS.  I changed the Skype setting to 8081 but, because I haven't figured out who's using IIS, I ended up changing Apache to 8080.
    In looking closely at httpd.conf I noticed that I had coded LISTEN 8080 but the example (proceeded by the "#") was "LISTEN 12.34.56.78:80".  I don't know if I made a mistake when changing the entry and didn't specify "LISTEN 127.0.0.1:8080".  I tested both settings (i.e. with and without the IP) and it didn't seem to matter (i.e. the F12 test ended the same way).  Do you happen to know whether Apache is sensitive to the difference between Listen 80 and Listen 127.0.0.1:80?
    Again, the file copy on the test server is being updated when F12 is pressed.
    Tom

  • Problem with variables in dynamic SQL/PLSQL

    Hi, I have a problem I am trying to solve using a very short piece of dynamic SQL/PLSQL but I am having problems getting the variable values out of the dynamic block.
    I need to increment a counter which could be any one of 16 counters I am using and I want to avoid using nested IF statements.
    The variable to be incremented is made up of the 'scheme', the 'contributory category' and the 'employment category' (although not every combination is valid)
    The 'scheme' can be either 'no1', 'no2', 'off', 'cg' or 'amc'
    The 'contributory category' can be either 'cont' or 'noncont'
    The 'employment category' can be either 'ft' or 'pt'
    For example the total variable name could be 'v_cg_noncont_ft_count'
    I have created a variable by concatenating the various elements called v_incr_count_name which holds the name of the variable I want to increment.
    I am running this within an anonymous PLSQL block so I cannot use global variables meaning that my variables are not visible within a dynamic PLSQL block.
    As a result I think I will need to use bind variables with a PLSQL block or a SELECT FROM INTO SQL string
    I have tried various solutions including the following PLSQL solution:
    v_incr_count_name := 'v_'||v_scheme||'_'||v_cont_cat||'_'||v_emp_cat||'_count';
    sql_stmt := 'BEGIN :a := :a + 1; END;';
    EXECUTE IMMEDIATE sql_stmt USING v_incr_count_name;
    Unfortunately I am getting the 'IN bind variable bound to an OUT position' error which I suppose makes sense as I am trying to change the value of a variable in the main PLSQL block from within the dynamic block.
    Another (SQL) solution I tried was:
    v_incr_count_name := 'v_'||v_scheme||'_'||v_cont_cat||'_'||v_emp_cat||'_count';
    sql_stmt := 'SELECT '||v_incr_count_name||' + 1 FROM DUAL';
    EXECUTE IMMEDIATE sql_stmt INTO v_return;
    While this executes and returns the incremented value into v_return, I am still left unable to copy the returned value into the variable whose name is stored in v_incr_count_name
    Any help appreciated
    Cheers, Dan

    this shows the syntax for the using clause
    declare
    a number := 1;
    b number := null;
    v varchar2(10) := 'A';
    begin
    execute immediate 'begin :v1 := :v1 + 1; end;' using in out a;
    dbms_output.put_line(a);
    end;
    /but what you want cannot be done
    SQL> declare
      2  a number := 1;
      3  b number := null;
      4  v varchar2(10) := 'A';
      5  begin
      6  execute immediate 'begin '||v||' := :v1 + 1; end;' using in out a;
      7  dbms_output.put_line(a);
      8  end;
      9  /
    declare
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'A' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    ORA-06512: at line 6the variable "V" contains the name of the desired output variable ("A"). this errors because "A" is not defined within the scope of the dynamic sql.
    "into the variable whose name is stored in v_incr_count_name"
    pl/sql does not support dereferencing variables, so you can't do it.

  • SQL Transform with VARIABLE

    Hello!
    I have the SQL Transform with global variable.
    First, I have a script for iniciality the variable:
    $DATE_CUST= to_date('2011/11/15 00:00:00.000','YYYY/MM/DD HH24:MI:SS.FF');
    I print the variable, in the execution write:
    2800     896     PRINTFN     2011.11.15 00:00:00.000000000
    STEP in SQL Transforms: 
    1.  SELECT * FROM TABLE_CUSTOMER
    2.  PUSH the update Schema button
    3.  add the where clause:  WHERE DATE_CUSTOMER > [$DATE_CUST]
    4.  save the DataFlow.
    When the execute the job, But we got error...  The variable is null or empty
    In the log trace: 
    |Data flow DF_VAR|Reader SQL
    SELECT query <select * from TABLE_CUSTOMER
    WHERE DATE_CUSTOMER  > 
    The database error message is <Sybase SQL Server <CRMGCPSA> error message for operation <ct_results>: <Sybase ASE Server message number <102> State <1> Severity <15> From Server <ASEDWHD>:   Message Text is: Incorrect syntax near ')'.
    >.
    Why no have value the variable ?
    The script correct should be
    SELECT query <select * from TABLE_CUSTOMER
    WHERE DATE_CUSTOMER  >  2011.11.15 00:00:00.000000000

    Both braces and square brackets can be used to reference variables, however they behave slightly differently.
    suppose I have the following hard-coded SQL statement
    select * from al_funcinfo where name = 'avg'
    Now I want to make it dynamic, I can use a variable and some square brackets
    select * from al_funcinfo where name = '[$G_Name]'
    or braces
    select * from al_funcinfo where name = {$G_Name}
    As you can see, braces adds single quotes around the varible value.  It is very useful when constructing complex statements requiring string values to be delimited with quotes (as most SQL DBs do).  These variable interpolation techniques can be used in scripts.
    M

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

  • Are we allowed to use the Web developer function in Firefox version 5.0 to edit the html source code associated with the Firefox home page?

    Locking at request of OP - https://support.mozilla.com/en-US/questions/844506
    Are we allowed to use the Web developer function, under the "Firefox" tab in Firefox version 5.0, to edit the html source code associated with the Firefox version 5.0 home page ( so that we can personalize the home page )? Is this legal?
    Sincerely in Christ,
    Russell E. Willis

    Solution: (Free Download Manager)
    Go here: http://codecpack.co/download/Free_Download_Manager.html and download Free Download Manager 3.8.1067 Beta 3, it works perfectly with Firefox 5.0.1
    Solution: (to Google mail aka Gmail)
    I have had this problem for a while since I did a previous Firefox update, where I had to force Gmail to load in Basic HTML else it's next to impossible to use it. The solution is this: simply update your Java, and Gmail will work without a problem using Standard HTML. To update your Java go here: http://www.java.com/en/ and select "Free Java Download".
    And beta normally, universally, means "the not quite there yet version of the version we're aiming for" NORMALLY used during production and testing of a type of software.

  • Fetch web page with PL/SQL

    How do I fetch web page with as short PL/SQL code as possible. I don't want to send headers, read requests, just download it at once. Are there alternatives to UTL_HTTP.REQUEST which hangs on my system? Can I use one of the XDB packages to do that?
    Przemek

    Call from your browser with www.domain.com/AAA001A.HomePage
    CREATE OR REPLACE PACKAGE AAA001A AS
      PROCEDURE HomePage;
    END AAA001A;
    CREATE OR REPLACE PACKAGE BODY AAA001A AS
      PROCEDURE HomePage IS
      BEGIN
         htp.init;
          htp.htmlOpen;
            htp.headOpen;
              htp.title('HomePage');
            htp.headClose;
            htp.bodyOpen;
                 htp.p('Hello World!');
            htp.bodyClose;
          htp.htmlClose;
      END HomePage;
    END AAA001A;
    /Just re-read your OP and realised this is not what you were looking for and is in context of your request absolute drivel!
    Message was edited by:
    scorpio_online

  • How to create sql query for item master with operator LIKE with variables?

    hi all,
    How to create sql query for item master with
    operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
    Jeyakanthan

    Hi Jeyakanthan,
    here is an example (put the like statement into the where field)
    SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
    The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
    Regards Steffen

  • Problem connecting JSF page with SQL server 2005 DB

    hello guys,
    i have tried working with the visual web JSF in NET BEANS 6.1 IDE.
    i get an error connecting the jsf page witht he sql server 2005 db.
    i get an odbc:jdbc error.
    can anyone gimme the exact correct coding to connect a a jsf page with the sql server 2005 db.
    expecting a reply soon...
    thanks a lot....
    sandeep

    You need to elaborate a bit more about the problem.
    Read this to get more chance on suitable help: [http://www.catb.org/~esr/faqs/smart-questions.html].

  • How to pass page session variable to on-demand PL/SQL process

    I am trying to execute a stored procedure that takes two page session variables as input and executes code based on those two variables. I have tried creating a stored procedure on the db-side and calling it using:
    BEGIN
    PROC_UPDT_EMP(&P23_TC_ID, &P23_EMP_ID);
    END;
    but APEX rejects the variables.
    I have also tried putting in the entire procedure in APEX as well, but I get the same problem. I have also tried using the :P23_TC_ID syntax, and still a no-go. What am I doing wrong?

    If PROC_UPDT_EMP is a stored procedure that takes 2 IN parameters, you would do
    proc_updt_emp(:P23_TC_ID,:P23_EMP_ID);in an after-submit page process. That would pass in the values of those 2 items from session state.

  • Interactive Reports - SQL Source Question

    Background
    Apex 3.1 is installed on Oracle 10g instance on local machine but all data is stored on a remote machine on Oracle 9 & 10 instances.
    This data is also used by another piece of software, which directly manipulates the data.
    The Apex Application that I am developing is to be used as a Quick Find/KPI Reporting tool and is setup to utilise DBLinks and Synonyms.
    Within the remote data, we have a mapping table that contains user specific alias' for field names, which the users set using the other piece of software. There can be up to 5 mappings per table field each defined as LNG01, LNG02,etc.
    In order to provide the same field Alias' in the Apex application, I have created a PL/SQL function to return the field alias and return a string value containing the final SQL.
    Problem
    In standard reports, this would work correctly as you could return a SQL statement in a string and it handled it with no problems.
    However, due to Interactive Reports not supporting this, I have tried to find code to pass in the string SQL Statement to return a TABLE or PIPELINED datasource.
    The string SQL statement will vary for each time it is used so the string SQL statement is effectively built as dynamic SQL
    This causes as problem as I will never be able to define the ROWTYPE for a type TABLE variable as the field names will not be constant.
    Can you tell me if there is any way to create a SQL source that could be used for the Interactive Report based on dynamic SQL?
    Alternatively, if you can provide any alternatives to finding a solution I would be most grateful.
    Apologies if this question has been posted before.
    Thanks in advance.
    Stuart

    Stuart,
    You could:
    1) Create page items, one for each dynamic column header (e.g. P1_OBJECT_NAME_HEADER, etc).
    2) Create a page process, to run when the page is loaded, that populates each item with the appropriate text. This can pull the column header text from your remote source.
    3) Use a static query as your interactive report source:
        select objname,
               objuniqueid,
               objtypecode,
               objsitearea,
               objdesc,
               objdesc2,
               objlocationid,
               objcommission
          from cdoweb_om4) Edit the interactive report attributes -- use APEX substitution string syntax to reference the item values (e.g. "&P1_OBJECT_NAME_HEADER." without the quotes) instead of static column headers.
    For more information on using substitution strings:
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/concept.htm#BEIFGFJF
    - Marco

Maybe you are looking for

  • Panther to Leopard

    I've seen this topic discussed but haven't seen my particular problem. I can't get the computer to accept the Leopard DVD as it is ejected after a few moments. I have no clue what other problems I may run into but I would at least like to start the p

  • Help with Mail program

    Hello, I am having trouble with my Mail program. Since turning on my computer this morning, I cannot get the program to respond. It will open, but it just sits with the timer going, and none of the emails show up. I have to do a force quit on it and

  • IPhoto and Kodak EasyShare software

    I find myself using Kodak's EasyShare software a lot more than iPhoto-- especially since I can click on the slide show and see both photos and videos in the same slide show-- BUT with both programs, my photo/video folders are getting huge-- over 25 g

  • Help - I am trying to dowload adobe air, but I keep getting error message #0

    Hi, I am the administrator, I am the only account on the computer. What is happening?

  • HT204389 Having problems with Siri on iPone 5

    Morning all. I'm having trouble with Siri. Yesterday she simply stopped understanding me. Everything i say to her she just replies with "Sorry, Nath, Something's gone wrong. Can you try that again?" With every request. Full reception both on 3G and W