Plz help me create a Procedure with create view cmd

i want to create a view from the procedure like the following one,
It creates the proc but while running it show invalid column name please help me;
create or replace procedure asho2005.mock_pro( fin_fr_dt in date, fin_to_dt in date) is
     ffdt date;
     ftdt date;
begin
     select to_date(fin_fr_dt,'dd-mm-yyyy') into ffdt from dual;
     select to_date(fin_to_dt,'dd-mm-yyyy') into ftdt from dual;
execute immediate 'create or replace view mock_vu as select a.amt from cbtran a where chq_dt > ffdt and chq_dt <ftdt';
end;

i want to create a view from the procedure like the
following one,
It creates the proc but while running it show invalid
column name please help me;
create or replace procedure asho2005.mock_pro(
fin_fr_dt in date, fin_to_dt in date) is
     ffdt date;
     ftdt date;
begin
select to_date(fin_fr_dt,'dd-mm-yyyy') into ffdt
t from dual;
select to_date(fin_to_dt,'dd-mm-yyyy') into ftdt
t from dual;
execute immediate 'create or replace view mock_vu
vu as select a.amt from cbtran a where chq_dt > ffdt
and chq_dt <ftdt';
end;Hallo,
your problem is , that execute immediate does't recognize ffdt
You have to concatenate literals
create or replace procedure asho2005.mock_pro( fin_fr_dt in date, fin_to_dt in date) is
ffdt date;
ftdt date;
begin
select to_date(fin_fr_dt,'dd-mm-yyyy') into ffdt from dual;
select to_date(fin_to_dt,'dd-mm-yyyy') into ftdt from dual;
execute immediate 'create or replace view mock_vu as select a.amt from cbtran a where chq_dt > '''||ffdt||''' and chq_dt <'''||ftd||'''';
end; BTW, your view doesn't return any rows
ffdt and < ffdt :-)
Besides that , it's a very very bad method!
You must not create views in runtime. Use of literals results in hard parsing .
The performance will be poor.
You have to create view in design time, and then simply use select:
select * from mock_vu where chq_dt > (your_date) and something else
HTH
Regards
Dmytro
corrected wrong number of quotes (no wonder ) :-)
Message was edited by:
Dmytro Dekhtyaryuk

Similar Messages

  • Please help to call oracle procedure with out paramter from shell script

    Hi
    I want to call a process with out parameter from shell script. I am calling process in shell script in below way
    function Process_loads {
    ( echo 'set serveroutput on size 1000000 arraysize 1'
    echo "set pagesize 0 term on verify off feedback off echo off"
    echo "BEGIN"
    echo " dbms_output.put_line('Before Calling The package'); "
    echo " x ( '$1', '$2', '$2', '$4', '$5', '$error_code'); "
    echo " dbms_output.put_line('After Calling The package'); "
    echo "EXCEPTION "
    echo " WHEN OTHERS THEN "
    echo " dbms_output.put_line('BIN_LOAD_ERROR' || SQLERRM); "
    echo " ROLLBACK;"
    echo "END;"
    echo "/" ) | sqlplus -s $USER/$PASSWORD@$SID
    Here $error_code is out paramter. All varaibles passed in process are declared with export command.
    When executing .sh it gives below error
    "sh ERROR at line 3: ORA-06550: line 3, column 99: PLS-00363: expression '' cannot be used as an assignment target ORA-06550: line 3, column 3: PL/SQL: Statement ignored".
    Please help to get rid from this error or please suggest how to call a oracle procedure with out paramter from unix shell script.
    Thanks in advance

    You can try this:
    From sql*plus
    SQL> ed
      1  create or replace procedure my_proc(p_id in int, p_result out int)
      2  as
      3  begin
      4  select 10 * p_id
      5  into p_result
      6  from dual;
      7* end my_proc;
    SQL> /
    Procedure created.
    SQL> set serveroutput on
    SQL> declare
      2  v_r int;
      3  begin
      4  my_proc(10,v_r);
      5  dbms_output.put_line(v_r);
      6  end;
      7  /
    100
    PL/SQL procedure successfully completed.
    from bash:
    testproc.sh:
    #!/bin/bash
    (echo 'set serveroutput on';
    echo 'declare';
    echo 'v_r int;';
    echo 'begin';
    echo 'my_proc(10,v_r);';
    echo 'dbms_output.put_line(v_r);'
    echo 'end;';
    echo '/';) | sqlplus -s u1/u1
    Console:
    oracle@mob-ubuntu:~$ chmod u+x testproc.sh
    oracle@mob-ubuntu:~$ ./testproc.sh
    100
    PL/SQL procedure successfully completed.With kind regards
    Krystian Zieja

  • PLZ help in interfacing my VI with NI 5640

    I am interfacing Ni 5640 PCI with the example VI of the modulation toolkit "QAM transceiver" using the instrument driver of PCI 5640 not the labview FPGA driver
    My final constellation is with lot of errors.
    I am finding problems in setting the parameters of the PCI 5640. I am using the single tone generation VI at transmiter side and Spectrum measurement example Vi at RX side.
    parameters I am setting are
    at TX: 
    sampling rate of the complex cluster I am giving to ni 5640 R write waveform is 1600k S/s
    IQ rate giving to ni 5640 R configure generation is 1600k S/s
    Symbol rate is 100k Hz
    pulse shaping root raised cosine using 16 samples per symbol
    AT RX:
    what should be the span if i see in the example spectrum measurement or the IQ rate at the ni 5640 R configure acquisition
    how much samples to acquire?
    if my transmitted bits are 1044 and applying 4 QAM on them
    how should I resample my received array of IQ data????
    PLZ help or give me any example of a transceiver system interfaced with NI 5640r using instrument driver.

    good...yaar am too from AU
    so which dept r u from???and name..am from telecom A
    we r also doing 16 qam on dsp 6713, using labview...do meet me so dat we can resolve each others issues....
    regards
    wajahat Hassan

  • Help in creating View

    Hi Guys,
    I am trying to create a view from table A and table B.  Data in table A and table B are as follows.
    Table A                              TableB
    Field_1       Field_2                    Field_1           Desc_1
    A1          B1                    A1          New York     
    A1          B1                    A2          Albany
    A1          B2                    A3          Rochester     
    A1          B2                    A4          Buffalo
    A1          B2                    A5          Syracuse
    A2          B1                              
    A2          B2
    I want to get the following result:
    Field_1        Desc_1          Field_2     
    A1          New York     B1                    
    A1          New York     B1                    
    A1          New York     B2                         
    A1          New York     B2                    
    A1          New York     B2                    
    A2          Albany          B1                              
    A2          Albany          B2
    Please advise me which type of view should I create. I create Maintenance view and I am getting following error"
    "No database view exists for view Z_TEST_VIEW".
    Please help in creating a view without the error.
    Thanks,

    Since your requirement is to view logically connected data from different tables, try creating the "database view".
    http://help.sap.com/saphelp_nw70/helpdata/en/cf/21ecab446011d189700000e8322d00/content.htm

  • PLZ HELP in interfacing NI 5640 with my VI

    I am interfacing Ni 5640 PCI with the example VI of the modulation toolkit "QAM transceiver" using the instrument driver of PCI 5640 not the labview FPGA driver
    My final constellation is with lot of errors.
    I am finding problems in setting the parameters of the PCI 5640. I am using the single tone generation VI at transmiter side and Spectrum measurement example Vi at RX side.
    parameters I am setting are
    at TX: 
    sampling rate of the complex cluster I am giving to ni 5640 R write waveform is 1600k S/s
    IQ rate giving to ni 5640 R configure generation is 1600k S/s
    Symbol rate is 100k Hz
    pulse shaping root raised cosine using 16 samples per symbol
    AT RX:
    what should be the span if i see in the example spectrum measurement or the IQ rate at the ni 5640 R configure acquisition
    how much samples to acquire?
    if my transmitted bits are 1044 and applying 4 QAM on them
    how should I resample my received array of IQ data????
    PLZ help or give me any example of a transceiver system interfaced with NI 5640r using instrument driver.
    AIRIAN

     Hi Airian,
    I think your question was answered here. Please post back
    if you need further help. Also, Please keep your posts to a single thread, as
    it helps the community to easily follow the resolution.
    David L.
    Systems Engineering
    National Instruments

  • Plz Help i wanna buy 5800 with GPS!!!!

    Hi, I'm Wesam - live in egypt, i wanna buy nokia 5800 but when i went to buy it i found that all packages written on it (NO NAV) ?
    is it means these devices don't have GPS (GPS now available in Egypt) and if i buy it i wanna know can i update my software device to have this facility in future or this is a hardware must be added in the manufacture.
    Plz help me cuz i need to change my mobile and i wanna 5800 be my next mobile, thnx

    I dont know really, but it seems that my phone have some sort of GPS system. and i have 5800, really great phone. but still it shuld not have been realesed so quickly. still some mayor system buggs Nokia have to take care of.

  • Plz help. Created manual backup; won't load on new computer (save FF version). Restore appears to work fine but bookmarks aren't there.

    I followed the posted manual bookmark backup posted at this link:
    [http://example.com http://support.mozilla.com/en-US/kb/Backing%20up%20and%20restoring%20bookmarks]
    Followed the info and backed up my old bookmarks to a file on a USB flash drive. When I follow the same instructions to restore, everything appears to be working correctly. I say ok to replace current bookmarks with saved file, close...and then nothing has been overwritten/none of my saved bookmarks appear. What am I doing wrong? Are the old bookmarks saved in an area I'm not looking in?

    What kind of backup did you make?
    A JSON backup or an HTML backup?
    Restoring a JSON backup will replace all current bookmarks and importing an HTML backup will add the bookmarks to each of the three main (root) bookmarks folders. You can open an HTML file in Firefox via File > Open File to see all the bookmarks in that file.
    Make sure that the backup file with the bookmarks has the correct file extension: .html for a HTML backup and .json for a JSON backup.<br />
    You can check that via the right-click context menu of that file and open the Properties.<br />
    If you are not sure about the file type then you can open the file in Firefox via "File > Open File"<br />
    A JSON backup will show as one long text line without line breaks and a HTML backup as a web page with clickable links.<br />
    <br />
    * http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • Plz help me in inter sto with cin

    Hi,
    can any help me, what Transaction codes has to be followed for inter company code with CIN .
    i know inter company sto cycle without CIN , here i have requirement that Inter company STO with excise duties.
    Thanks in advance,
    Rgds,
    K.Praveen

    Hi,
    In Inter company STO with CIN
    Create STO in recieving plant & send to Supplying plant
    Include the excise duties in the STO in the condtions.
    Supplying plant do the Outbound Delivery in VL10B for that STO with post goods issue with 641 mvt type
    Billing document will be created with reference to Delivery doc no
    Create the Excise invoice in J1IIN transaction with reference to Billing document.
    Send the Excise invoice along with material to Recieving plant
    Recieiving plant will do the Goods receipt with respect to the Outbound delivery in 101 mvt type
    Recieiving plant will Capture & post the excise invoice in MIGO or J1IEX.
    Excise registister will update as per the posting.
    rgds
    gsc

  • Help in calling stored procedure with parameter in JSP

    I need to know how to call this stored procedure in JSP
    here is my Stored procedure in oracle 9i:
    CREATE OR REPLACE procedure broker_activity
    (p_broker_id IN number,p_TotalValue out number,p_CrossValue out number, p_blockValue out number, p_MktWeight out number,p_BuyingVal out number, p_sellingVal out number, p_NetValue out number)
    AS
    begin
    declare
    -- buying value
    cursor c_BuyingVal is select buyer_firm, sum(volume*price) value from last_sale where buyer_firm = p_broker_id group by buyer_firm;
    -- selling value
    cursor c_SellingVal is select seller_firm,sum(volume*price) value from last_sale where seller_firm = p_broker_id group by seller_firm;
    v_BuyingCurVal c_buyingVal%rowtype;
    v_SellingCurVal c_sellingVal%rowtype;
    n_buy_val number :=0;
    n_sell_val number :=0;
    n_total_value number := 0;
    begin
    --buying value
    open c_BuyingVal;
    fetch c_BuyingVal into v_buyingCurVal;
    n_buy_val := nvl(n_buy_val,0) + v_buyingCurVal.value;
    --Exit when c_BuyingVal%NOTFOUND;
    close c_buyingVal;
    p_BuyingVal := n_buy_val;
    --selling value
    open c_SellingVal;
    fetch c_SellingVal into v_SellingCurVal;
    n_sell_val := nvl(n_sell_val,0) + v_SellingCurVal.value;
    -- Exit when c_BuyingFirm%NOTFOUND;
    close c_SellingVal;
    p_SellingVal := n_sell_val;
    --total value
    p_TotalValue := n_buy_val + n_sell_val;
    --cross val
    select sum(volume*price) into p_CrossValue from last_sale where board = 'C' and (buyer_firm = p_broker_id or seller_firm = p_broker_id);
    --block Sale
    select sum(volume*price) into p_BlockValue from last_sale where board = 'B' and (buyer_firm = p_broker_id or seller_firm = p_broker_id);
    --Net Value
    p_NetValue := n_buy_val - n_sell_val;
    --markte_weight
    select (sum(volume*price) * 2)/100 into p_MktWeight from last_sale ;
    end;
    end;

    http://developer.java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html

  • Help in creat view

    i have a accounting table consist of the folwing fields:
    ACC_ID NOT NULL NUMBER(10)
    ACC_DESC VARCHAR2(100)
    ACC_PARENT_ID NUMBER(6)
    IS_PARENT NUMBER(1)
    and another table for transacion have two filds:
    ACC_ID NUMBER(10)
    AMOUNT NUMBER(20,2)
    THE ACCOUNT TABLE Is a Hierarchical
    when i insert the value in transaction table the acc_id should not be PARENT ACCOUNT
    I wnat the result of view in this way
    acc_id is_parent amount
    1 1 5000
    11 1 5000
    111 1 5000
    1111 0 1500
    1112 0 1500
    1113 0 2000
    the sumation in the parent account debent on the sumation of chield account
    i hope if i find the help

    CREATE TABLE ACC (
    ACC_ID VARCHAR2(12) PRIMARY KEY,
    ACC_DESC VARCHAR2(100),
    PARENT_ACC VARCHAR2(12),
    IS_PARENT NUMBER(1));
    INSERT INTO ACC VALUES('1','ACC1',NULL,1);
    INSERT INTO ACC VALUES('11','ACC2',1,1);
    INSERT INTO ACC VALUES('111','ACC3','11',1);
    INSERT INTO ACC VALUES('1111','ACC41','111',0);
    INSERT INTO ACC VALUES('1112','ACC42','111',0);
    INSERT INTO ACC VALUES('1113','ACC43','111',1);
    INSERT INTO ACC VALUES('11131','ACC43','1113',0);
    CREATE TABLE TRANS (
    ACC_ID VARCHAR2(12),
    AMOUNT NUMBER(10,2));
    INSERT INTO TRANS VALUES (1111,3000);
    INSERT INTO TRANS VALUES (1112,5000);
    INSERT INTO TRANS VALUES (11131,4000);

  • Plz help me rooting XPERIA play with GB 2.3.4

    i dont wanna unlock the bootloader...if possible neither i wanna downgrade 2.3 to root my phone using gingerbreak....
    i want a safe rooting for 2.3.4 on xperia play...so that i can play games without getting online evrytym and install titanium back up app.....can u plz suggest some method??
    i am a newbie in dis matter so i am giving the info,i dont know if it is required at all...but...
    kernel version:
    2.6.32.9-perf
    SEMCUser@SEMCHost#1
    build number:
    4.0.2.A.0.58
    if there is some method plz explain in detail....
    Solved!
    Go to Solution.

    See how to root 2.3.4
    {GUIDE} How to Root Xperia™ Smartphones
    Discussion guidelines.
    Message me or any other moderator to seek help regarding moderation.

  • Need help in creating a view with Encryption for hiding the code used by the multiple users

    Hi,
    Can anyone help me out in creating view with encryption data to hide the stored procedure logic with other users.
    I have create a stored procedure with encryted view but while running this manually temporary views are getting created, therefore the problem is if there are 500 entries then 500 temp views will get created.
    Any solution to aviod creating temporary views, please refer my code below
    USE [etl_validation]
    GO
    /****** Object:  StoredProcedure [dbo].[Pr_DBAccess_mod]    Script Date: 05/23/2014 12:53:22 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[Pr_DBAccess_mod](@ETL_CONFIG_ID INT)
    AS
    BEGIN
    DECLARE @openquery NVARCHAR(MAX),
     @DATABASENAME NVARCHAR(100),
     @HIERNAME NVARCHAR(100),
     @TABLENAME NVARCHAR(100),
     @SERVERTYPE NVARCHAR(100),
     @SERVERNAME NVARCHAR(100),
     @USERNAME NVARCHAR(100),
     @PASSWORD NVARCHAR(100),
     @ETL_CONFIG_IDN NVARCHAR(100);
     SET @ETL_CONFIG_IDN=CAST(@ETL_CONFIG_ID AS NVARCHAR);
     SET @TABLENAME='Department';
     SET @SERVERTYPE='SQL';
     SET @SERVERNAME ='192.168.31.176';
     SET @DATABASENAME='AdventureWorks2008R2';
     SET @HIERNAME = 'HumanResources';
     IF @SERVERTYPE='SQL'
     BEGIN
    /*SET @openquery= 'SELECT * INTO ##TestTable
                     FROM OPENROWSET(''SQLNCLI'',''server=192.168.31.176;Trusted_Connection=yes;'','''+@query+''')'
    SET @openquery=  'CREATE VIEW '+@TABLENAME+@ETL_CONFIG_IDN+
                     ' WITH ENCRYPTION AS SELECT * FROM OPENROWSET(''SQLNCLI'',''SERVER='+@SERVERNAME+';TRUSTED_CONNECTION=YES;'',''SELECT * FROM '+@DATABASENAME+'.'+@HIERNAME+'.'+@TABLENAME+''')'
    SELECT @openquery
    END
    EXECUTE sp_executesql @openquery
    END

    Hi aa_rif,
    According to your description and code message, you execute the sp_executesql statement in your stored procedure, it indeed create many views with a tablename and ETL_CONFIG_ID named. If you need not to use these temporary views, you can delete them when
    it contains the tablename in one view name.  
    In addition, if you want to create view with encryption in SQL Server, you can use directly the ENCRYPTION option to encrypt the T-SQL of a view in create view commands, for more information, see:
    http://learnsqlserver.in/4/Create-View-With-Encryption.aspx. if not, you can descript more detail about requriements, so that more forum members can involve into the thread and help you
    out. 
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • I am not able to link my bank account with the store .... So I am not able to download anything from the store plz help

    Plz help in liking my account with the apple store     Because I am not able to download anything from apple store

    Have you called your credit card issuer? They may be able to provide a reason for the declined purchased.
    Also, you can only register for and use the App Store in the country your credit card is issued. Be sure you are buying apps from the correct App Store.

  • Plz help me to solve

    Hi..
    I m getting problem when i executing the below proc..
    I m taking the string of personid's from frntend and as our COM doesn't support ',' i getting the values seperated by pipe '|' and in proc i m repalcing it to ',' and den i have to chk it in IN condition and take all da records in a Cursor and i hav return bac.. But when i hardcoding the values i m getting result but when i using da variable string it is nt fecthing data..plz help me
    CREATE OR REPLACE PROCEDURE prn_tst(strVal IN     VARCHAR2)
         AS
              strl VARCHAR2(40);
              cur SYS_REFCURSOR;
              strname VARCHAR2(60);
         BEGIN
              SELECT REPLACE(strval,'|',',') INTO strL FROM DUAL;
              DBMS_output.put_line(strL);
              SELECT (REPLACE(strl,'+','''')) INTO strL FROM DUAL;
              DBMS_output.put_line(strL);
              OPEN cur FOR          
                   SELECT name
                   FROM cmnperson
                   WHERE TO_CHAR(personid) IN (strL);     
              LOOP
                   FETCH cur INTO strname;
                   EXIT WHEN cur%NOTFOUND;
                   DBMS_output.put_line('IN' || strname);
              END LOOP;
              SELECT name
              INTO strname
              FROM cmnperson
              WHERE TO_CHAR(personid) IN (TRIM(strL));
              DBMS_output.put_line('IN' || strname);
         END prn_tst;

    i have this procedure it is giving err when i m compling
    PLS-00103: Encountered the symbol "))
    INNER JOIN PRGNOSSPROGRAM
    ON
    CDTAPPLICATION.progr" when expecting one of the following:
    ( - + case mod new null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current max min prior sql stddev sum variance execute
    forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    CREATE OR REPLACE PROCEDURE prn_ACCertPrintRep(strCandidateid In Varchar2,
                                  strAccode In Cdtapplication.accode %TYPE,
                        strBatchNo In Cdtapplication.batchno %TYPE,
                                  cur_GetCertDetails Out SYS_REFCURSOR)
         AS
         strtemp Varchar2(50);
         strlist Varchar2(50);
         strFinalList Varchar2(50);
         strCode Varchar2(20) :='PC';
         BEGIN
         SELECT replace(strCandidateid,'|',',')
              INTO strtemp
         FROM dual;
         SELECT replace(strtemp,'-','''')
              INTO strlist
         FROM dual;
         dbms_output.put_line(strlist);     
         OPEN cur_GetCertDetails
              FOR                    
              'SELECT cdtapplication.programcode As PrgCode,
                   programname,
              programlevel,
              cmnperson.name As PersonName,
              icnumber,     
              acname,
              accenter.town As Town,
              sctstate.name As State
              FROM (CDTAPPLICATION
              INNER JOIN CDTPPLEVALUATIONH
                   ON
                        CDTAPPLICATION.candidateid = CDTPPLEVALUATIONH.candidateid
                   AND
                        UPPER(TRIM(CDTAPPLICATION.wfstatuscode)) = ' || strCode || ')
                   AND
                        TO_CHAR(CDTAPPLICATION.candidateid) IN (' || strlist || ')
              INNER JOIN ACCENTER
                   ON
                        CDTAPPLICATION.accode = ACCENTER.accode
                   AND
                        UPPER(TRIM(CDTAPPLICATION.accode)) = UPPER(TRIM(' ||strAccode || '))
                   AND
                        UPPER(TRIM(CDTAPPLICATION.batchno)) = UPPER(TRIM(' ||strBatchNo ||'))
              INNER JOIN PRGNOSSPROGRAM
                   ON
                        CDTAPPLICATION.programcode = PRGNOSSPROGRAM.programcode
              INNER JOIN CMNPERSON      
                   ON
                        CDTAPPLICATION.personid = CMNPERSON.personid)
              INNER JOIN SCTSTATE
                   ON
                        ACCENTER.statecode = SCTSTATE.statecode;
         END prn_ACCertPrintRep;

  • What is the use of enabling "speak notifications" on under the voice over in ios5 ? can it read out my notifications?? plz help...

    i have recently updated my iphone 4 to ios 5. in the accessibility options i found the voice over and inside that i found the "speak notifications" . i enabled it on.. but doesnt know whats that for? can ny one help me? will it read out my notifications aloud? but its not working plz help..

    create your own entreprise!indeed
    I had a "dream" job for a while. a guy - who writes books on software process, and is a member of the agile alliance - had an idea for a product, sat on it for 15 years then left his job and started a company. he assembled his team personally, and 8 of us sat in a room and worked to make his idea a reality. he was the management, and he was also the most talented programmer of us all. the team ran beautifully, we rarely had a deadline to work to, save the odd launch here and there, and there was absolutely zero office politics. all we did was write code, toss ideas about, play with the development process and sometimes go karting, or to the pub, or for a curry or something. I actually looked forward to going to work every day, because of this free reign we had, and we all turned out orders of magnitude more code than anywhere else I've ever worked. but the investors got nervous and pulled funding, leaving the project somewhat crippled. nice while it lasted, though, and I learnt more in my short time there than I did at university, and across 5 years experience in other companies
    so the answer is: come up with an idea, be expert enough to assemble and manage the perfect team and convince some rich people to lend you lots of money. simple. but be prepared. this guy was routinely doing 18 hour days, 6 days a week (he was a Christian, otherwise he'd undoubtedly be doing 8 days a week). he'd be out and about most of the day doing sales and marketing, flying around the world for meetings and stuff, then come into the office and code for 8-9 hours a night

Maybe you are looking for