Create table runs in Toad but not in Linux

Hello,
I've just started writing in SQL 3 days ago so I would like to apologize in advance for the shabby code and the stupid question. I'm hoping that somebody can help me with my problem.
Anyway, this has been bugging me for 2 days now and I can't seem to find the problem. The code below is just a simple create table that I coded in Toad for Oracle by Quest Software and runs fine in it but when I try to copy it over to our linux server and run it using '@/home/user/atm_dc.sql', the table is not created.
Can someone help me?
Thanks.
drop table atm_dc;
CREATE TABLE atm_dc
AS (
SELECT
'I' as action_code,
rpad(' ',22,' ') as card_num,
rpad(' ',24,' ') as client_cd,
'000119' as inst_cd,
rpad(sa01mast.brncd,6,' ') as branch_cd,
' ' as vip_flag,
' ' as owner_cd,
'0' as basic_card_flag,
rpad(' ',22,' ') as basic_card_num,
rpad(' ',4,' ') as title,
case when length(cf01cif.sname) > 0 then
rpad(cf01cif.sname,20,' ') else
rpad(' ',20,' ') end as family_name,
rpad(' ',20,' ') as first_name,
rpad(' ',26,' ') as embossed_name,
rpad(' ',26,' ') as encoded_name,
case when length(cf01cif.maritsts) > 0 then
case when cf01cif.maritsts in ('M') then '2' else '1' end else
' ' end as marital_status,
case when length(cf01cif.sex) > 0 then
case when cf01cif.sex in ('F') then 'F' else 'M' end else
' ' end as gender,
rpad(' ',15,' ') as legal_id,
'608' as nationality_code,
'00' as num_of_children,
rpad('0',12,'0') as credit_limit,
'0' as issuers_client,
' ' as lodging_period,
' ' as res_status,
rpad('0',12,'0') as net_yearly_income,
'00' as no_of_dependents,
case when length(cf01cif.birthdt) > 0 then
to_char(cf01cif.birthdt,'YYYYMMDD') else rpad(' ',8,' ')
end as birth_date,
rpad(' ',5,' ') as birth_city,
case when length(cf01cif.cntry) > 0 then
rpad(cf01cif.cntry,3,' ') else rpad(' ',3,' ')
end as birth_cntry,
case when length(cf01addr.addr1) > 0 then
rpad(substr(cf01addr.addr1,1,30),30,' ') else rpad(' ',30,' ')
end as address1,
case when length(cf01addr.addr2) > 0 then
rpad(substr(cf01addr.addr2,1,30),30,' ') else rpad(' ',30,' ')
end as address2,
case when length(cf01addr.addr3) > 0 then
rpad(substr(cf01addr.addr3,1,30),30,' ') else rpad(' ',30,' ')
end as address3,
case when length(cf01addr.addr4) > 0 then
rpad(substr(cf01addr.addr4,1,30),30,' ') else rpad(' ',30,' ')
end as address4,
case when length(cf01addr.city) > 0 then
rpad(substr(cf01addr.city,1,5),5,' ') else rpad(' ',5,' ')
end as city_code,
case when length(cf01addr.postcd) > 0 then
rpad(cf01addr.postcd,10,' ') else rpad(' ',10,' ')
end as zip_code,
case when length(cf01addr.cntry) > 0 then
rpad(cf01addr.cntry,3,' ') else
rpad(' ',3,' ') end as country_code,
rpad(' ',15,' ') as phone_no1,
rpad(' ',15,' ') as phone_no2,
rpad(' ',15,' ') as mobile_phone,
rpad(' ',50,' ') as email_id,
rpad(' ',40,' ') as employer,
rpad(' ',30,' ') as emp_addr1,
rpad(' ',30,' ') as emp_addr2,
rpad(' ',30,' ') as emp_addr3,
rpad(' ',30,' ') as emp_addr4,
rpad(' ',5,' ') as emp_city_cd,
rpad(' ',10,' ') as emp_zip_cd,
rpad(' ',3,' ') as emp_cntry_cd,
rpad(' ',8,' ') as cont_start_dt,
' ' as emp_status,
to_char(sa01mast2.opendt,'YYYYMMDD') as open_dt,
rpad(' ',8,' ') as start_val_dt,
'001' as prod_code,
'0' as delivery_mode,
rpad(sa01mast.brncd||sa01mast.modcd||lpad(sa01mast.acno,6,'0')||
lpad(sa01mast.chkdgt,2,'0'),24,' ') as account1,
'PHP' as acct1_currency,
case when sa01mast.crline in ('SA') then '10' else '20'
end as account1_type,
rpad(' ',12,' ') as limit_cash_dom,
rpad(' ',12,' ') as limit_purch_dom,
rpad(' ',12,' ') as limit_te_dom,
rpad(' ',12,' ') as reserved1,
rpad(' ',12,' ') as limit_cash_int,
rpad(' ',12,' ') as limit_purch_int,
rpad(' ',12,' ') as limit_te_int,
rpad(' ',12,' ') as reserved2,
rpad(' ',12,' ') as autho_limit_dom,
rpad(' ',12,' ') as autho_limit_int,
rpad(' ',12,' ') as reserved3,
rpad(' ',4,' ') as activity_cd,
rpad(' ',4,' ') as socio_prof_code,
'00' status_code,
rpad(' ',10,' ') as staff_id,
'0' as delivery_flag,
rpad(' ',8,' ') as delivery_date,
rpad(' ',14,' ') as bank_dsa_ref,
rpad(' ',50,' ') as ud_field1,
rpad(' ',50,' ') as ud_field2,
rpad(' ',50,' ') as ud_field3,
rpad(' ',50,' ') as ud_field4,
rpad(' ',50,' ') as ud_field5,
rpad(' ',26,' ') as emboss_line3,
rpad(' ',45,' ') as mailing_addr1,
rpad(' ',45,' ') as mailing_addr2,
rpad(' ',45,' ') as mailing_addr3,
rpad(' ',45,' ') as mailing_addr4,
rpad(' ',10,' ') as mailing_zip_code,
rpad(' ',5,' ') as mailing_city_code,
rpad(' ',3,' ') as mailing_country_code,
rpad(' ',15,' ') as phone_home,
rpad(' ',15,' ') as phone_alt,
rpad(' ',15,' ') as phone_mobile,
'0' as photo_indicator,
' ' as language_indicator,
rpad(' ',25,' ') as maiden_name,
rpad('0',8,'0') as check_sum
FROM cf01cif, sa01mast, cf01addr, sa01mast2
WHERE cf01cif.cifkey=sa01mast.cifkey and
     cf01cif.cifkey=cf01addr.cifkey and
sa01mast2.brncd = sa01mast.brncd and
sa01mast2.modcd = sa01mast.modcd and
sa01mast2.acno = sa01mast.acno and
sa01mast2.chkdgt = sa01mast.chkdgt and
          sa01mast2.opendt < sysdate
);

You can use the SPOOL command to create a output file. Run the below script. This will create a file "output.log". Check in the file for any error messages
set echo on
spool output.log
drop table atm_dc
CREATE TABLE atm_dc
AS (
SELECT
'I' as action_code,
rpad(' ',22,' ') as card_num,
rpad(' ',24,' ') as client_cd,
'000119' as inst_cd,
rpad(sa01mast.brncd,6,' ') as branch_cd,
' ' as vip_flag,
' ' as owner_cd,
'0' as basic_card_flag,
rpad(' ',22,' ') as basic_card_num,
rpad(' ',4,' ') as title,
case when length(cf01cif.sname) > 0 then
rpad(cf01cif.sname,20,' ') else
rpad(' ',20,' ') end as family_name,
rpad(' ',20,' ') as first_name,
rpad(' ',26,' ') as embossed_name,
rpad(' ',26,' ') as encoded_name,
case when length(cf01cif.maritsts) > 0 then
case when cf01cif.maritsts in ('M') then '2' else '1' end else
' ' end as marital_status,
case when length(cf01cif.sex) > 0 then
case when cf01cif.sex in ('F') then 'F' else 'M' end else
' ' end as gender,
rpad(' ',15,' ') as legal_id,
'608' as nationality_code,
'00' as num_of_children,
rpad('0',12,'0') as credit_limit,
'0' as issuers_client,
' ' as lodging_period,
' ' as res_status,
rpad('0',12,'0') as net_yearly_income,
'00' as no_of_dependents,
case when length(cf01cif.birthdt) > 0 then
to_char(cf01cif.birthdt,'YYYYMMDD') else rpad(' ',8,' ')
end as birth_date,
rpad(' ',5,' ') as birth_city,
case when length(cf01cif.cntry) > 0 then
rpad(cf01cif.cntry,3,' ') else rpad(' ',3,' ')
end as birth_cntry,
case when length(cf01addr.addr1) > 0 then
rpad(substr(cf01addr.addr1,1,30),30,' ') else rpad(' ',30,' ')
end as address1,
case when length(cf01addr.addr2) > 0 then
rpad(substr(cf01addr.addr2,1,30),30,' ') else rpad(' ',30,' ')
end as address2,
case when length(cf01addr.addr3) > 0 then
rpad(substr(cf01addr.addr3,1,30),30,' ') else rpad(' ',30,' ')
end as address3,
case when length(cf01addr.addr4) > 0 then
rpad(substr(cf01addr.addr4,1,30),30,' ') else rpad(' ',30,' ')
end as address4,
case when length(cf01addr.city) > 0 then
rpad(substr(cf01addr.city,1,5),5,' ') else rpad(' ',5,' ')
end as city_code,
case when length(cf01addr.postcd) > 0 then
rpad(cf01addr.postcd,10,' ') else rpad(' ',10,' ')
end as zip_code,
case when length(cf01addr.cntry) > 0 then
rpad(cf01addr.cntry,3,' ') else
rpad(' ',3,' ') end as country_code,
rpad(' ',15,' ') as phone_no1,
rpad(' ',15,' ') as phone_no2,
rpad(' ',15,' ') as mobile_phone,
rpad(' ',50,' ') as email_id,
rpad(' ',40,' ') as employer,
rpad(' ',30,' ') as emp_addr1,
rpad(' ',30,' ') as emp_addr2,
rpad(' ',30,' ') as emp_addr3,
rpad(' ',30,' ') as emp_addr4,
rpad(' ',5,' ') as emp_city_cd,
rpad(' ',10,' ') as emp_zip_cd,
rpad(' ',3,' ') as emp_cntry_cd,
rpad(' ',8,' ') as cont_start_dt,
' ' as emp_status,
to_char(sa01mast2.opendt,'YYYYMMDD') as open_dt,
rpad(' ',8,' ') as start_val_dt,
'001' as prod_code,
'0' as delivery_mode,
rpad(sa01mast.brncd||sa01mast.modcd||lpad(sa01mast.acno,6,'0')||
lpad(sa01mast.chkdgt,2,'0'),24,' ') as account1,
'PHP' as acct1_currency,
case when sa01mast.crline in ('SA') then '10' else '20'
end as account1_type,
rpad(' ',12,' ') as limit_cash_dom,
rpad(' ',12,' ') as limit_purch_dom,
rpad(' ',12,' ') as limit_te_dom,
rpad(' ',12,' ') as reserved1,
rpad(' ',12,' ') as limit_cash_int,
rpad(' ',12,' ') as limit_purch_int,
rpad(' ',12,' ') as limit_te_int,
rpad(' ',12,' ') as reserved2,
rpad(' ',12,' ') as autho_limit_dom,
rpad(' ',12,' ') as autho_limit_int,
rpad(' ',12,' ') as reserved3,
rpad(' ',4,' ') as activity_cd,
rpad(' ',4,' ') as socio_prof_code,
'00' status_code,
rpad(' ',10,' ') as staff_id,
'0' as delivery_flag,
rpad(' ',8,' ') as delivery_date,
rpad(' ',14,' ') as bank_dsa_ref,
rpad(' ',50,' ') as ud_field1,
rpad(' ',50,' ') as ud_field2,
rpad(' ',50,' ') as ud_field3,
rpad(' ',50,' ') as ud_field4,
rpad(' ',50,' ') as ud_field5,
rpad(' ',26,' ') as emboss_line3,
rpad(' ',45,' ') as mailing_addr1,
rpad(' ',45,' ') as mailing_addr2,
rpad(' ',45,' ') as mailing_addr3,
rpad(' ',45,' ') as mailing_addr4,
rpad(' ',10,' ') as mailing_zip_code,
rpad(' ',5,' ') as mailing_city_code,
rpad(' ',3,' ') as mailing_country_code,
rpad(' ',15,' ') as phone_home,
rpad(' ',15,' ') as phone_alt,
rpad(' ',15,' ') as phone_mobile,
'0' as photo_indicator,
' ' as language_indicator,
rpad(' ',25,' ') as maiden_name,
rpad('0',8,'0') as check_sum
FROM cf01cif, sa01mast, cf01addr, sa01mast2
WHERE cf01cif.cifkey=sa01mast.cifkey and
cf01cif.cifkey=cf01addr.cifkey and
sa01mast2.brncd = sa01mast.brncd and
sa01mast2.modcd = sa01mast.modcd and
sa01mast2.acno = sa01mast.acno and
sa01mast2.chkdgt = sa01mast.chkdgt and
sa01mast2.opendt < sysdate
spool off

Similar Messages

  • Created disc running on macs but not on any dvd player

    Hey I am trying to make a short film that includes stills and video, I shot my footage in 108024p used after effects exported back out to FCP and then made a quicktime movie with the same settings (HDV 108024p) I used compressor to convert the footage to DVD SP-H.264 10.3Mbs.mov then made a project in DVD SP using HD DVD and NTSC settings, then tested my dvd with the simulator, worked, burned my copy and worked on my mac as well as my brothers mac though it does not work on any dvd player in the house (blueray players) does anyone have any suggestions, I included all the relevant information that I could think of. Thank you

    That's because you made an HD DVD, just as you said. You would need an HD DVD player.
    DVD players can only play DVDs, Blu-ray players can play DVDs and Blu-ray discs. Only an HD DVD player (a dead format) will play an HD DVD.
    You have to start your project over in SD mode.

  • My codes run in windows but not in Linux what is wrong?

    //I have 4 codes in total but heres is one for example
    import java.util.*;
    // This state accepts numeric input less than 100 and subtracts
    // 1 from each input number before exiting the state.
    // We exit the state if the input is exactly 100.
    public class AState extends State {
    public AState (String n, boolean d ) {
    super(n,d);
    public void RUN () {
    int ch = 0;
    entry();
    Scanner stdin = new Scanner(System.in);
    ch = stdin.nextInt();
    while ( ch != 100 ) {
    ch--;
    System.out.print(" " + ch);
    ch = stdin.nextInt();
    // change state from AState to BState
    Controller.state = Controller.states[Controller.BSTATE];
    // this will be the AState version of exit().
    exit();
    //It runs perfectly in windows but once I compile in a terminal of Linux it doesn't run it show like 8 errors, why is that, can somebody tell me what can I do about it

    public class AState extends State {
    ^
    Astate.java:18: cannot find symbol
    symbol : method entry()
    location: class AState
    entry();
    ^
    ./Controller.java:8: class BState is public, should be declared in a file named BState.java
    public class BState extends State {
    ^
    ./Controller.java:8: cannot find symbol
    symbol: class State
    public class BState extends State {
    ^
    Astate.java:31: cannot access Controller
    bad class file: ./Controller.java
    file does not contain class Controller
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    Controller.state = Controller.states[Controller.BSTATE];
    ^
    6 errors
    //As i said before, this run perfently through windows the same exactly code.

  • How to creat commitment for PO PR but not creat statistical cost for GR

    Hi,
    Quantities and Values in Valuated Project Stock: Example - Material - SAP Library
    Planning
    Material FIN-M is assigned to network activity V10 and is managed in the project stock for WBS element P/4711.1.
    The network type is flagged as appended and apportioned to the WBS.
    Before the first MRP planning run or before the planned orders are converted into purchase requisitions or production orders, the following amounts appear in WBS element P/4711.1:
    Planned costs of $500,00
    Remaining order plan value of $300,00
    The MRP controller begins by converting the planned orders. First, the planned order for the material RAW-M is converted into a purchase requisition and the planned order for the material SEMI-M is converted into production order A2.The order type is flagged as not appended and apportioned to the WBS.The remaining order plan value in the WBS element changes by the amount of the internal activities portion of production order A2 to $400,00 (300,00 + 100,00).After the purchase requisition is converted into a purchase order, a cost commitment of $50,00 also appears in WBS element P/4711.1.
    External Procurement
    Valuated goods are received for the purchase order, but the price is $10 different at $60. Assuming that material RAW-M is price-controlled, this gives rise to a debit posting of $60,00 in the stock account and credit posting of $60 in the GR/IR clearing account (Financial Accounting).If the inventory accounts was created as a cost element in CO, the following appear in WBS element P/4711.1:
    Statistical actual costs of $60,00 in the stock cost element
    A cost commitment of $0,00
    If material RAW-M is price-controlled the standard price is $50,00, the postings in Financial Accounting are: $50,00 debit to a stock account $10,00 debit to a price difference $60,00 credit to the GR/IR clearing account
    In this case, the only figure in the WBS element would be statistical actual costs of $50,00.
    Above excerpt from SAP help, may I know how to do configuration to creat commitment for PO PR but not creat statistical cost for GR?
    Thanks and regards,
    Ray

    Hello Jie,
    if i right assuming your query then PR->PO= Commitment should be created.
    but GRN by MIGO=Statistical cost should not create once MIGO if right then actual cost would be 0.
    you can activate commitment by OKKP transaction.
    And you want to cost should not be statistical after MIGO right?
    here solution is cost never statistical type until account assignment object not statistical type this is my assumption.
    if this is the issue then check G/L account from the PO. then check that G/L account, whether it is a B/S account or P&L account? I think you have wrongly assigned P&L account.
    Regards,
    Sanjeev

  • How do I create both endnotes and footnotes in same doc in Pages? I have iWork 2008. I understand how to create one or the other, but not both.

    How do I create both endnotes and footnotes in same doc in Pages? I have iWork 2008. I understand how to create one or the other, but not both.

    You have to select one or the other.
    Try making two documents and see if you can merge the .pdfs, but their will be problems with page flow, making the pages shift. Can't see it working really.
    Pages is not the only solution out there or the best for most jobs (let alone the safest). Try Word for Mac, LibreOffice (free) or any App that has the features you need.
    Peter

  • Query runs in TOAD but hangs in Reports

    How does one begin to diagnose where a query run in Reports is hanging? The query runs in TOAD but never finishes when run within the report. Strange thing is that the query/report ran (unchanged from this month) for prior months.
    Is there a "run-time visual debugger" for reports?

    Each query, including the 5th, runs to completion when run separately. It appears to be the addition of the 5th query which causes the problem.
    NEWS FLASH: The report ran to completion over the weekend (almost totally idle server). However, it took over 90 minutes to finish.
    Immediately after optimizing the queries and indicies, the report has been known to complete in 3 minutes. Over time, this has crept back up to 20 minutes.
    The DBAs think a change in DBMS optimization might have caused this particular query to exceed a threshhold. They're looking at reversing this change to see the affect on the query.

  • Query working fine in toad but not in forms 6i

    i have following coding on when button press triger
    declare
    CURSOR C1(year number,month number) IS
    SELECT ITM_NO,ITM_NAME,XAQ QTY,XAQ*TP VAL,gp
    FROM
    select ci.itm_no ITM_NO,ci.itm_name ITM_NAME ,cpg.group_id gp ,xaq ,ALLIED.CORP_PRIC_TP( ci.itm_no)TP from
    select prod_no,sum(xaq)*1 xaq
    from
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_01_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_02_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_03_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_04_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    group by prod_no
    ) A,allied.corp_inv ci,allied.corp_01_01 c01, allied.corp_01_02 c02,allied.corp_prod_group cpg,allied.v_prod_grp vpg
    where ci.itm_no=a.prod_no
    and ci.itm_no=c02.itm_no
    and c01.grp_id=c02.grp_id
    and c01.grp_id in(55,56,57,58,59)
    and vpg.prod_no =ci.itm_no
    and vpg.group_id=cpg.group_id
    where XAQ <>0;
    Begin
         delete from fiaz.tmp_topten_prod;
         for i in c1(:year,:month)
    loop
              insert into fiaz.tmp_topten_prod
              values(i.itm_no,i.itm_name,i.qty,i.val,i.gp,0);
         end loop;      
    standard.commit;
    message('inserted in temp');
         exception when others then
              message (dbms_error_text);
              message (dbms_error_text);
    End;
    Same Query (as used in cursor c1) works fine in toad but giving wrong result from forms... and the problem is xaq field i.e returns incorrect qty...
    i guess union clause is not working in this situation...
    plz suggest me the appropriate changes in the query to work well from form as well...
    combination:Forms 6i,Oracle 8.0.6
    Regards,
    Usman Afzal

    As per your suggestion i have created a stored procedure but the followin error prevents procedure creation
    create or replace procedure fiaz.topten_prod(v_yr number,v_mn number) is
    begin
    delete from fiaz.tmp_topten_prod;
    insert into fiaz.tmp_topten_prod(itm_no,itm_name,qty,val,grp_id,prority)
    SELECT ITM_NO,ITM_NAME,XAQ QTY,XAQ*TP VAL,gp,0
    FROM
    select ci.itm_no ITM_NO,ci.itm_name ITM_NAME ,cpg.group_id gp ,xaq ,ALLIED.CORP_PRIC_TP( ci.itm_no)TP from
    select prod_no,sum(xaq) xaq
    from
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq from allied.mrk_01_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_02_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_03_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_04_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    group by prod_no
    ) A,allied.corp_inv ci,allied.corp_01_01 c01, allied.corp_01_02 c02,allied.corp_prod_group cpg,allied.v_prod_grp vpg
    where ci.itm_no=a.prod_no
    and ci.itm_no=c02.itm_no
    and c01.grp_id=c02.grp_id
    and c01.grp_id in(55,56,57,58,59)
    and vpg.prod_no =ci.itm_no
    and vpg.group_id=cpg.group_id
    where XAQ <>0;
    commit;
    end;
    Error:
    "PLS-00201: identifier ALLIED.MRK_01_02 must be declared "
    i have not changed any thing in query working fine in toad without create procedure text and if i describe this table it shows the structure (desc allied.mrk_01_02)
    Now where is the problemmmmm
    Plz Help

  • Case Working in "TOAD" but not Working in "WHERE" clause

    Hi Friends,
    When I am using case in the where clause of SQL query in Oracle Reports 3.0.5, than it is giving me "Error - Rep - 0946 Unable to Parse Query"
    But when I am running the same query in TOAD it is working fine.
    select *from inv_stores, inv_product, inv_location
    where  (inv_stores.location_code in ('12', '13', '16', '17', '18') and
                inv_stores.location_code = inv_location.location_code and
                inv_stores.department_code = inv_product.department_code and
                inv_stores.product_code = inv_product.product_code and
                nvl(delete_flag, 'N') <> 'Y' and
                inv_product.department_code = '11' and
                       (((CASE WHEN nvl(inv_product.sale_price3jd,0) = 0 THEN 0  ELSE (nvl(inv_product.sale_price3jd,0) - nvl(inv_product.cost_pricejd,0)) /
                       nvl(inv_product.sale_price3jd,0) END) *  100 ) <= 100))
    order by inv_product.department_code, inv_product.product_codePlease Help me.......
    Thanks in Advance

    Hello,
    When you create a SQL query in Reports, Reports will parse the SQL query in order to create the "data model".
    Reports 3.0.5 is quite old, so, you can use only the SQL "supported" by the RSF included in Reports 3.0.5.
    When you use TOAD , the sql query is not parsed by TOAD but by the DB just like with sqlplus or SQL Developer.
    Regards

  • Seeing decimal values in TOAD, but not in SQL Developer

    I'm writing on behalf of a co-worker. He's using SQL Developer to look at some records in a database, but in one column he sees zeroes instead of the correct decimal values (the values are between 0 and 1).
    However, the developer he's working with is using TOAD and sees the correct decimal values in the column.
    Any idea as to how to get the decimal values to appear correctly within SQL Developer?

    The database version is 10g, the version supported by TOAD is 9.
    Hi ,
    1/I have not seen this reported please give a create
    table statement and some test data to insert to
    reproduce the problem.. Please give versions of
    SQLDeveloper and the Oracle database - out current
    production release of SQLDeveloper is 1.5.1(.54.40)
    2.If you can convert the number to a string at the
    database side say with TO_CHAR you should see the
    string representation of the number in SQLDeveloper.
    This would work if you are using a select via the
    worksheet or a view on the table with the number if
    you want to see it in a views data tab.
    -Turloch

  • DROP TABLE works through SSMS but not via T-SQL Query

    Hello All,
    I am trying to drop a number of tables (1,000+) in a particular database by scripting the actions in T-SQL. When I run the query I get error 3701 on every table which points to a permissions issue. However, I am able to delete tables one by one using
    the tree-view in the SSMS Object Explorer. 
    1. I have tried starting query sessions with both the DBO of the database and the SA account to no avail. (Both had the sysadmin role when I tried.)
    2. Both the DBO account and the SA account are able to drop tables using SSMS Object Explorer.
    Do I need a specific GRANT of permissions to use T-SQL versus SSMS or am I missing something even more fundamental?
    TIA, Simon
    <code>
    DECLARE @Company VARCHAR(max), 
    @ID VARCHAR(max), 
    @NAME VARCHAR(max), 
    @TABLE_CATALOG VARCHAR(max),
    @NAV_DATABASE VARCHAR(max),
    @TABLE_NAME VARCHAR(max), 
    @STATEMENT VARCHAR(max),
    @OBJECT_NAME VARCHAR(max),
    @OBJECT_NAME_BARE VARCHAR(max),
    @OBJECT_TYPE VARCHAR(max);
    SET @TABLE_CATALOG = 'NAV_PENTA_TEST_GAAP';
    SET @NAV_DATABASE = @TABLE_CATALOG
    IF @TABLE_CATALOG <> DB_NAME() 
    BEGIN
    DECLARE @ERRORMSG VARCHAR(max);
    SET @ERRORMSG =  'You are not in the correct database. You specified ' + @TABLE_CATALOG + ' but you are currently in a session for ' + db_name();
    RAISERROR(@ERRORMSG, 18, 1);
    RETURN;
    END;
    -- To hold the object names (tables) from Navision
    CREATE TABLE #NavisionObjects
    [CompanyName]
    VARCHAR(max),
    [ID] VARCHAR(max),
    [Name]
    VARCHAR(max),
    [TABLE_NAME]
    VARCHAR(max)
    -- To hold the object names (tables) from SQL only
    CREATE TABLE #NavisionSQLObjects
    [TABLE_NAME]
    VARCHAR(max)
    -- Holds the list of dependent objects
    CREATE TABLE #DependentObjects
    [name] VARCHAR(max),
    [type] VARCHAR(max)   
    WITH T AS (
    SELECT [Company Name],[ID],[Name],[Company Name]+'$'+[Name] AS TABLE_NAME 
    FROM [Object]   
    WHERE [Name] like '%IT IS%' AND [Company Name]>''
    UNION ALL
    SELECT [Company Name],[ID],[Name],[Name] AS TABLE_NAME 
    FROM [Object]   
    WHERE [Name] like '%IT IS%' AND [Company Name] IN ('',' ')
    INSERT INTO #NavisionObjects SELECT [Company Name],[ID],[Name],[TABLE_NAME] FROM T;
    UPDATE #NavisionObjects SET TABLE_NAME = TABLE_NAME+ID WHERE ID LIKE '1%';
    INSERT INTO #NavisionSQLObjects 
    SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES 
    WHERE TABLE_CATALOG = @TABLE_CATALOG AND TABLE_NAME LIKE '%IT IS%' AND TABLE_TYPE='BASE TABLE';
    --SELECT * FROM #NavisionObjects where CompanyName like 'E15%' order by TABLE_NAME;
    --SELECT * FROM #NavisionSQLObjects where TABLE_NAME like 'E15%' order by TABLE_NAME;
    DECLARE cTables CURSOR FOR SELECT A.CompanyName,A.ID,A.[TABLE_NAME] FROM #NavisionObjects A
    INNER JOIN #NavisionObjects B ON B.[TABLE_NAME]=A.[TABLE_NAME]
    OPEN cTables;
    FETCH NEXT FROM cTables INTO @Company,@ID,@TABLE_NAME;
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
    PRINT 'Storing dependencies for [' + @TABLE_NAME + ']';
    BEGIN TRY
    INSERT INTO #DependentObjects 
    EXEC sp_depends @TABLE_NAME;
    END TRY
    BEGIN CATCH
    PRINT 'Could not get dependencies for table [' + @TABLE_NAME + ']';
    END CATCH
    FETCH NEXT FROM cTables INTO @Company,@ID,@TABLE_NAME;
    END
    CLOSE cTables;
    Drop dependent objects first so that table drops are less likely to fail. 
    DECLARE cdo CURSOR FOR SELECT [Name],[Type] FROM #DependentObjects;
    OPEN cdo;
    FETCH NEXT FROM cdo INTO @OBJECT_NAME, @OBJECT_TYPE;
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
    BEGIN TRY
    SET @OBJECT_NAME_BARE = 
    CASE 
    WHEN CHARINDEX('dbo',@OBJECT_NAME) = 1
    THEN RIGHT(@OBJECT_NAME,LEN(@OBJECT_NAME)-4)
    ELSE @OBJECT_NAME
    END;
    SET @STATEMENT = 'DROP ' + @OBJECT_TYPE + ' [' + @OBJECT_NAME_BARE + ']';
    PRINT @STATEMENT;
    EXEC sys.sp_sqlexec @STATEMENT;
    END TRY
    BEGIN CATCH
    PRINT 'Could not DROP object [' + @OBJECT_NAME + '] of type ' + @OBJECT_TYPE + ', SQL Error ' + CAST(@@ERROR AS VARCHAR(max));
    END CATCH
    FETCH NEXT FROM cdo INTO @OBJECT_NAME, @OBJECT_TYPE;
    END
    CLOSE cdo;
    DEALLOCATE cdo;
    OPEN cTables;
    FETCH NEXT FROM cTables INTO @Company,@ID,@TABLE_NAME;
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
    PRINT 'Removing [' + @TABLE_NAME + ']' ;
    BEGIN TRY
    SET @STATEMENT = 'TRUNCATE TABLE dbo.[' + @TABLE_NAME + ']';
    PRINT @STATEMENT;
    EXEC sys.sp_sqlexec @STATEMENT;
    END TRY
    BEGIN CATCH
    PRINT 'Could not truncate table [' + @TABLE_NAME + ']';
    END CATCH
    BEGIN TRY
    SET @STATEMENT = 'DROP TABLE dbo.[' + @TABLE_NAME + ']';
    PRINT @STATEMENT;
    EXEC sys.sp_sqlexec @STATEMENT;
    BEGIN TRY
    SET @STATEMENT = 'DELETE FROM [Object] WHERE [Company Name] = ' + CHAR(39) + @Company + CHAR(39) + ' AND [ID] = ' + CHAR(39) + @ID + CHAR(39) + ' AND [TABLE_NAME] = ' + CHAR(39) +
    @TABLE_NAME + CHAR(39) ;
    EXEC sys.sp_sqlexec @STATEMENT;
    print @STATEMENT;
    END TRY
    BEGIN CATCH
    PRINT 'Could not Delete Object [' + @TABLE_NAME + '], from Object table, SQL Error ' + CAST(@@ERROR AS VARCHAR(max));
    END CATCH
    END TRY
    BEGIN CATCH
    PRINT 'Could not DROP table [' + @TABLE_NAME + '], SQL Error ' + CAST(@@ERROR AS VARCHAR(max));
    END CATCH
    FETCH NEXT FROM cTables INTO @Company,@ID,@TABLE_NAME;
    END
    CLOSE cTables;
    DEALLOCATE cTables;
    DROP TABLE #DependentObjects;
    DROP TABLE #NavisionObjects;
    DROP Table #NavisionSQLObjects;
    </code>

    3701 = ...does not exist or you don't have permission.
    Most of the time it means the former. So there are probably some problems in your DROP TABLE statements. Since there is a whole lot about Navision in the script, I decline from trying to figure out what. But I encourage you to study the PRINT statements.
    I think that it would be a good idea to include the schema name, in cases these tables are not in dbo after all.
    Note: rather than writing:
       SET @STATEMENT = 'DROP ' + @OBJECT_TYPE + ' [' + @OBJECT_NAME_BARE + ']';
    write:
       SET @STATEMENT = 'DROP ' + @OBJECT_TYPE + quotename(@OBJECT_NAME_BARE)
    Somewhat briefer. And it works also when the object name includes a right bracket.
    sp_sqlexec is undocumented, use sp_executesql instead.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Procedure to move table - running procedure as woner not caller

    I seem to remember there is a way of getting a procedure to run as the user owning it rather than the one calling this. This is my main question. Below is some background. The other thing I am trying work out is what is the best way of doing a grant from a procedure, I guess execute immediate is the way to go.
    Background:
    OK, this may seem a strange requirement but as there is no safe way of allowing a user to create/drop tables in a different (team shared) schema we are planing on getting the user to create the table in there own schema and then call a procedure to move it to team schema.
    I think this can be done with 2 procedures (possibly in a single package).
    a) move_table_to_team - owned by team with user1 having execute permissions.
    b) move_table_to_team_remote - owned by team with user1 having execute permissions BUT run as team schema (i.e. the scema owning proc) not user calling it (so it can create tables).
    So the steps are:
    1) user1 creates table table1
    2) user1 calls move_table_to_team('table1');
    3) move_table_to_team grants select on table1 to team schema
    4) move_table_to_team calls move_table_to_team_remote(username,team1).
    5) move_table_to_team_remote does a 'create table team.table1 as select * from user1.table1 where 1=2'
    6) retrun to move_table_to_team
    7) drop table1.
    Regards,
    Ben

    Hi, Ben,
    orangetwig wrote:
    I seem to remember there is a way of getting a procedure to run as the user owning it rather than the one calling this. This is my main question. That's right:
    CREATE OR REPLACE PACKAGE  pkg_name
    AUTHID  DEFINER
    AS ...Actually, DEFINER is the default invoker-rights. You only have to specify AUTHID when you want the package to run with the caller's privilegers:
    CREATE OR REPLACE PACKAGE  pkg_name
    AUTHID  CURRENT_USER
    AS ...
    Below is some background. The other thing I am trying work out is what is the best way of doing a grant from a procedure, I guess execute immediate is the way to go.Yes, use EXECUTE IMMEDIATE in PL/SQL for everything except queries and DML.
    Background:
    OK, this may seem a strange requirement but as there is no safe way of allowing a user to create/drop tables in a different (team shared) schema we are planing on getting the user to create the table in there own schema and then call a procedure to move it to team schema.Yes, that's a problem. To create (or drop) a table in sombody else's schema, you need the privileges to create (or drop) tables in anybody else's schema, and you don't want to grant that to lots of people.
    Can't you allow the individual developers to log in as the team user when they need to create (or drop) tables there? If the team owns other objects, and you want to prevent users from tanpering with them, you could create a team_transfer schema, that contains only the tables copied from the individual users, and have them log in to that.
    I think this can be done with 2 procedures (possibly in a single package).
    a) move_table_to_team - owned by team with user1 having execute permissions.
    b) move_table_to_team_remote - owned by team with user1 having execute permissions BUT run as team schema (i.e. the scema owning proc) not user calling it (so it can create tables).
    So the steps are:
    1) user1 creates table table1
    2) user1 calls move_table_to_team('table1');
    3) move_table_to_team grants select on table1 to team schema
    4) move_table_to_team calls move_table_to_team_remote(username,team1).
    5) move_table_to_team_remote does a 'create table team.table1 as select * from user1.table1 where 1=2'
    6) retrun to move_table_to_team
    7) drop table1.
    Regards,
    BenStep 5 has to be done with the team privileges, but steps 1, 3 and 7 have to be doen with the individual's privileges. I think you'll need two packages, one with AUTHID DEFINER to create or drop objects in the team schema, and the other with AUTHID CURRENT_USER to create or drop objects in the individual schemas. A package can call procedures in another package, so the user can do the whole job with just one call.

  • Create table in PL/SQL proc not working

    Hello,
    Here is a procedure I have tried to create & run in SQL Developer:
    create or replace procedure transpose as
    begin
    create table lines as (select level line from dual connect by level <= 5),
    create table cols as (select level col from dual connect by level <= 5),
    select max(decode(col, 1,
    decode(line, 1, line_id,
    2, description,
    3, statetax,
    4, freight,
    5, weightedAvg))) col1,
    max(decode(col, 2,
    decode(line, 1, line_id,
    2, description,
    3, statetax,
    4, freight,
    5, weightedAvg))) col2,
    max(decode(col, 3,
    decode(line, 1, line_id,
    2, description,
    3, statetax,
    4, freight,
    5, weightedAvg))) col3,
    max(decode(col, 4,
    decode(line, 1, line_id,
    2, description,
    3, statetax,
    4, freight,
    5, weightedAvg))) col4,
    max(decode(col, 5,
    decode(line, 1, line_id,
    2, description,
    3, statetax,
    4, freight,
    5, weightedAvg))) col5
    from lines, cols,
    (select rownum rn, tfe_line_info.* from tfe_line_info)
    where rn = col
    group by line
    order by line;
    end transpose;
    I however get the error:
    Error(3,7): PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
    I cannot understand what is wrong with my Create statement at line 3?

    It looks like you have no PL/SQL experience. I suggest reading PL/SQL manual. Yes, single row select requires INTO clause. Multi-rows select requires cursor. But this is least of your problems. Your SPp will not complile even if you fix select. Why? SP creates tables dynamically at run time, so tables do not exist at SP compile time. Therefore select from these yet non-existent tables will not compile. By creating tables via dynamic SQL you forced yourself into querying them via dynamic SQL. Now you are trying to transpose (pivot) table. What Oracle version do you have? Oracle 11g provides PIVOT/UNPIVOT operators. Check them out before writing code.
    SY.

  • I want a user to use only import, it run with export but not import

    Hi,
    i create a user for use only for import and for export.
    batch_export with exp_full_database role <- It run
    batch_import with imp_full_database role <- don't run
    P:\>sqlplus batch_export/batch
    SQL*Plus: Release 10.1.0.2.0 - Production on Lun. Ao¹t 21 17:21:58 2006
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    ERROR:
    ORA-00604: une erreur s'est produite au niveau SQL rÚcursif 1
    ORA-20000: Connexion refusee
    ORA-06512: Ó ligne 41
    Entrez le nom utilisateur :
    P:\>sqlplus batch_import/batch@rfsage
    SQL*Plus: Release 10.1.0.2.0 - Production on Lun. Ao¹t 21 17:03:36 2006
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    ConnectÚ Ó :
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> exit
    the trigger as run
    create or replace trigger batch_export.check_connexion after logon on database
    declare
    V_MODULE SYS.V_$SESSION.module%TYPE;
    V_TERMINAL SYS.V_$SESSION.terminal%TYPE;
    V_SID SYS.V_$SESSION.SID%TYPE;
    V_SERIAL SYS.V_$SESSION.SERIAL#%TYPE;
    V_COMMAND varchar2(100);
    V_CURRENT_USER varchar2(20);
    V_CURRENT_SID SYS.V_$SESSION.SID%TYPE;
    cursor connexion is
    select substr(module,1,7) module, substr(terminal,1,12) terminal, sid, serial# from v$session T1 where schemaname='BATCH_EXPORT';
    cursor ID_CUR is
    select user from dual;
    cursor SID_CUR is
    select SYS_CONTEXT('USERENV','SID') sessionid from dual;
    --select SYS_CONTEXT('USERENV','CURRENT_USERID') current_userid from dual;
    Begin
    open SID_CUR;
    loop
    fetch SID_CUR into V_CURRENT_SID ;
    EXIT WHEN SID_CUR%NOTFOUND;
    dbms_output.put_line('V_CURRENT_SID:'||V_CURRENT_SID);
    end loop;
    close SID_CUR;
    open ID_CUR;
    loop
         fetch ID_CUR into V_CURRENT_USER ;
         EXIT WHEN ID_CUR%NOTFOUND;
         if V_CURRENT_USER='BATCH_EXPORT' then
         open connexion;
         loop
              fetch connexion into V_MODULE,V_TERMINAL,V_SID,V_SERIAL ;
              EXIT WHEN connexion%NOTFOUND;
              if V_MODULE<>'EXP.EXE' then
              dbms_output.put_line('V_SID:'||V_SID);
              dbms_output.put_line('V_CURRENT_USER:'||V_CURRENT_USER);
                   if V_CURRENT_SID=V_SID then
                   dbms_output.put_line('MODULE:'||V_MODULE);
                   RAISE_APPLICATION_ERROR (-20000,'Connexion refusee');
                   end if;
              end if;
         end loop;
         close connexion;
         end if;
    end loop;
    close ID_CUR;
    End;
    as the same for import user.
    I try with role in trigger but it don't, i see this in forum Oracle.
    But i think EXP_FULL_DATABASE have not DBA rule, but IMP_FULL_DATABASE have.
    How i do this ?
    I want just to use a user to imp utilities, but not connexion in sqlplus.
    Thanks for your help
    Christophe

    thanks for your help.
    it run !
    for example :
    as the system user
    SQL> INSERT INTO PRODUCT_USER_PROFILE values ('SQL*Plus', 'BATCH', 'CONNECT',null,null, 'DISABLED', NULL, NULL);
    1 ligne créée.
    SQL> grant create session to batch;
    Autorisation de privilèges (GRANT) acceptée.
    SQL> INSERT INTO PRODUCT_USER_PROFILE values ('SQL*Plus', 'BATCH', 'SELECT',null,null, 'DISABLED', NULL, NULL);
    1 ligne créée.
    the result
    oracle@debian:~$ sqlplus batch/batch;
    SQL*Plus: Release 10.2.0.1.0 - Production on Mar. Août 22 06:53:00 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connecté à :
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select user from dual;
    SP2-0544: Commande "select" désactivée dans le profil utilisateur du produit
    SQL>
    oracle@debian:~$ exp batch/batch owner=batch file=test.dump
    Export: Release 10.2.0.1.0 - Production on Mar. Août 22 06:54:32 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connecté à : Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export fait dans le jeu de car WE8DEC et jeu de car NCHAR AL16UTF16
    le serveur utilise le jeu de caractères WE8ISO8859P1 (conversion possible)
    Prêt à exporter les utilisateurs spécifiés ...
    . export des actions et objets procéduraux de pré-schéma
    . export des noms de bibliothèque de fonctions étrangères pour l'utilisateur BATCH
    . export des synonymes de type PUBLIC
    . export des synonymes de type PRIVATE
    Thanks for all

  • Newbie question: sql runs on sqlplus but not compile in pl/sql?

    I have the following two tables I would like to put a sql statement into pl/sql packages so I can use dbms_jobs automate it however, I keep getting compile time error. It seems to me that pl/sql does not like my sql that runs fine in sqlplus. Below is the error message and my test case?
    mdb_user@CMD> show error
    Errors for PACKAGE BODY DATA_QUALITY_REPORT_P:
    LINE/COL ERROR
    10/1 PL/SQL: SQL Statement ignored
    13/42 PL/SQL: ORA-00942: table or view does not exist
    create table S_ORG_EXT
    accnt_type_cd varchar2(100),
    cust_stat_cd varchar2(100)
    insert into s_org_ext
    select column_name,data_type from user_tab_columns where rownum <= 100
    select * from s_org_ext
    create table data_quality_report
    runid number not null,
    report_type number not null, --report type such as dup or not dup or other metrics
    org_level number not null, --organization level nsgn, sgn, shipto
    loc_level number not null,--locale level by city, by country, by region, grand_total
    name varchar2(100) not null,--the row output name of the agg
    value number not null,-- the row output value of the agg
    rundate date default sysdate
    create sequence data_quality_report_seq start with 1000
    INCREMENT BY 1
    NOCACHE
    NOCYCLE
    insert into data_quality_report
    select data_quality_report_seq.nextval,3,99,99,accnt_type_cd,cnt,sysdate from
    select accnt_type_cd, count (*) cnt from S_ORG_EXT where cust_stat_cd = 'VARCHAR2' group by accnt_type_cd order by 2 desc
    select * from data_quality_report
    truncate table data_quality_report
    CREATE or replace PACKAGE data_quality_report_p AS
    function pull_data return data_quality_report.runid%type;
    END data_quality_report_p ;
    create or replace package body data_quality_report_p as
    function pull_data return data_quality_report.runid%type is
    new_rid data_quality_report.runid%type;
    begin
    select data_quality_report_seq.nextval into new_rid from dual;
    insert into data_quality_report
    select new_rid,3,999999,999999,accnt_type_cd,cnt,sysdate from
    select accnt_type_cd, count (*) cnt from S_ORG_EXT where cust_stat_cd = 'VARCHAR2' group by accnt_type_cd order by 2 desc
    return new_rid;
    exception
    when no_data_found then
    DBMS_OUTPUT.PUT_LINE('Handling NO_DATA_FOUND exception.');
    when others then
    DBMS_OUTPUT.PUT_LINE('Handling OTHER exception.');
    end; --end pull_data
    end data_quality_report_p;
    /

    Hi,
    A very common cause for ORA-00942 in a stored procedure (here I'm including packages and functions) is that you have privileges only through a role. Roles don't count in stored procedures if they are compiled with the default "AUTHID DEFINER". Either
    (1) have whatever privileges you need (e.g. "INSERT ON data_quality_report" or "SELECT ON s_org_ext") granted directly to you (the package owner), or to the pseudo-user PUBLIC, and not merely to some role that you have, or
    (2) create the package in the same schema as the tables, or
    (3) create the package with "invoker's rights", like this
    CREATE OR REPLACE PACKAGE data_quality_report_p
    AUTHID CURRENT_USER       -- Added
    AS
        FUNCTION pull_data ...'AUTHID CURRENT_USER" goes right before the keyword "IS" (or "AS") in the package spec; you don't have to do anything to the package body.
    However, if you do this, then whoever runs the package will need to have those privileges, in addition to EXECUTE privileges on the package. Privileges granted through a role will be okay.
    Usually, (1) is the best solution. Have the table owner(s), or someone with the proper authority, grant privileges directly to you.
    By the way, there's no point in having an ORDER BY clause in a sub-query like you're doing, and there's no point in having ORDER BY in an INSERT statement. It's not causing the ORA_00932 error (or any other error), it's just wasting resources.
    Edited by: Frank Kulash on Mar 23, 2011 4:02 PM
    Change DEFINER to CURRENT_USER in a couple of places. (Bad mistake!)

  • Search for coding possible thru Toad, but not thru Forms Builder

    Hi all,
    I am searching for a particular word 'instalment' which is used in forms. when I search using 'Find and Replace PL/SQL' there are no matches. But in Toad, when i search in 'Find in Files', its displaying the code containing the above word in a particular .fmb file. why this is happening?? I am in urgent need of that code.
    Pls help me.. its urgent!!
    Edited by: user13106173 on Dec 6, 2010 3:05 AM

    When I open that file in Quick view from ToadWhich file are you referring too when you say "that file"? I assume you mean the Forms Module (.fmb), but I hate to assume things so could you please confirm this for me? ;-)
    How can we see attached library details?There is no way to view the PL/SQL code of an attached library except by opening the library in the Forms Builder. If your form has an attached library, the Object List Report will indicate there are attached libraries in the "Attached PL/SQL Libraries" section of the report.
    * Attached PL/SQL Libraries                        
       * Name                                            MY_LIB_NAME
       - Comments                                       
       * PL/SQL Library Location                         MY_LIB_NAME
       * Name                                            RP2RRO
       - Comments                                       
       * PL/SQL Library Location                         rp2rro
    But through forms builder, I cant see the below details. Don't quote me on this, but believe TOAD's quick view displays all of the code in the .fmb, even the code of an attached library, whereas Forms Builder will allow you to see the signature of the program units in the attached library, but not the code.
    Also the ct_message display item used here is not created in this particular form. It is in some other form. How this happens?Is the CT_MESSAGE display item a Subclassed item? Meaning, it was included in your form file through an Object Library or by copying the item to the form and choosing to subclass (create a reference to) the item rather than copy of the item in your form. Oracle Forms implements inheritence through the use of subclasses. By subclassing an item (be it a Visual widget [like a button] or a Program Unit) Forms stores a refernce to the object rather than the actual object. This allows you to share and reuse code and objects.
    Check the Object List Report of your form and see if there are any attached libraries. If there are attached libraries, open these libraries in Forms Builder to find your code. It is also also possible to subclass objects in your form file through the use of Object Libraries. Check your Object List Report to see if there is an Object Groups sections:
    * Object Groups                                    
       * Name                                            CALENDAR
       - Subclass Information                           
       - Comments                                       
       * Object Group Children                          
         * Name                                          WHEN-NEW-FORM-INSTANCE
         - Subclass Information                         
         * Real Object Pointed to by the Object Group Child
         * Name                                          WHEN-WINDOW-ACTIVATED
         - Subclass Information                         
         * Real Object Pointed to by the Object Group Child
    .....If the CT_MESSAGE item was added to your form thorugh an object library, it will be listed in this section of the object list report.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

Maybe you are looking for

  • Invoice GL Date vs Journal Accounting Date

    I created an invoices in AP. The invoice date and GL date for the invoice is 12-JAN-10. I ran create accounting process. A journal was created in GL. The accounting date for this journal is 31-JAN-10. Why the accounting date for the journal is not th

  • My iPod Touch 2G 4.2.1 is acting up on me. What can I do?

    I have an iPod Touch 2G with an iOS of 4.2.1. I've had it since 2011, when I found it slightly beaten up but still usable in the bottom of an old sofa chair. I think that one of my relatives accidentally let it slip from their pocket, but that's anot

  • Brush size

    Although my question might seem silly, for some reason I cannot fix it. I am open to any suggestion. I am using Photoshop CC on a Mac computer. Photoshop CC is up to date. The problem I am having is; for example if my brush size is 800px the active a

  • How do I delete a specific SMS without deleting ot...

    How do I delete a specific SMS without touching other SMS sent to other people?

  • CS6 opens only master pages?

    Hello, Recently, I upgraded my Adobe InDesign from CS5 to CS6. Since then, I have had three different files displaying a similar problem - when I open them, these files, they automatically open to my master page. This was pretty jarring the first tim